
// this is autogenerated file, do not edit it.
#include "ficus/ficus.h"

struct _fx_Nt9Dynvec__t1S_data_t;

static void _fx_free_Nt9Dynvec__t1S(struct _fx_Nt9Dynvec__t1S_data_t** dst);

struct _fx_N13Ast__binary_t_data_t;

static void _fx_free_N13Ast__binary_t(struct _fx_N13Ast__binary_t_data_t** dst);

struct _fx_Nt6option1FPv3N14K_form__atom_tR10Ast__loc_tR22K_form__k_fold_callb_t_data_t;

static void _fx_free_Nt6option1FPv3N14K_form__atom_tR10Ast__loc_tR22K_form__k_fold_callb_t(
   struct _fx_Nt6option1FPv3N14K_form__atom_tR10Ast__loc_tR22K_form__k_fold_callb_t_data_t** dst);

struct _fx_Nt6option1FPv2N14K_form__kexp_tR22K_form__k_fold_callb_t_data_t;

static void _fx_free_Nt6option1FPv2N14K_form__kexp_tR22K_form__k_fold_callb_t(
   struct _fx_Nt6option1FPv2N14K_form__kexp_tR22K_form__k_fold_callb_t_data_t** dst);

struct _fx_Nt6option1FPv3N14K_form__ktyp_tR10Ast__loc_tR22K_form__k_fold_callb_t_data_t;

static void _fx_free_Nt6option1FPv3N14K_form__ktyp_tR10Ast__loc_tR22K_form__k_fold_callb_t(
   struct _fx_Nt6option1FPv3N14K_form__ktyp_tR10Ast__loc_tR22K_form__k_fold_callb_t_data_t** dst);

struct _fx_Nt6option1FPN14K_form__atom_t3N14K_form__atom_tR10Ast__loc_tR17K_form__k_callb_t_data_t;

static void _fx_free_Nt6option1FPN14K_form__atom_t3N14K_form__atom_tR10Ast__loc_tR17K_form__k_callb_t(
   struct _fx_Nt6option1FPN14K_form__atom_t3N14K_form__atom_tR10Ast__loc_tR17K_form__k_callb_t_data_t** dst);

struct _fx_Nt6option1FPN14K_form__kexp_t2N14K_form__kexp_tR17K_form__k_callb_t_data_t;

static void _fx_free_Nt6option1FPN14K_form__kexp_t2N14K_form__kexp_tR17K_form__k_callb_t(
   struct _fx_Nt6option1FPN14K_form__kexp_t2N14K_form__kexp_tR17K_form__k_callb_t_data_t** dst);

struct _fx_Nt6option1FPN14K_form__ktyp_t3N14K_form__ktyp_tR10Ast__loc_tR17K_form__k_callb_t_data_t;

static void _fx_free_Nt6option1FPN14K_form__ktyp_t3N14K_form__ktyp_tR10Ast__loc_tR17K_form__k_callb_t(
   struct _fx_Nt6option1FPN14K_form__ktyp_t3N14K_form__ktyp_tR10Ast__loc_tR17K_form__k_callb_t_data_t** dst);

struct _fx_N14K_form__ktyp_t_data_t;

static void _fx_free_N14K_form__ktyp_t(struct _fx_N14K_form__ktyp_t_data_t** dst);

struct _fx_N14K_form__kexp_t_data_t;

static void _fx_free_N14K_form__kexp_t(struct _fx_N14K_form__kexp_t_data_t** dst);

struct _fx_Nt10Hashmap__t2ii_data_t;

static void _fx_free_Nt10Hashmap__t2ii(struct _fx_Nt10Hashmap__t2ii_data_t** dst);

struct _fx_Nt10Hashmap__t2SR9Ast__id_t_data_t;

static void _fx_free_Nt10Hashmap__t2SR9Ast__id_t(struct _fx_Nt10Hashmap__t2SR9Ast__id_t_data_t** dst);

typedef struct _fx_LS_data_t {
   int_ rc;
   struct _fx_LS_data_t* tl;
   fx_str_t hd;
} _fx_LS_data_t, *_fx_LS;

typedef struct _fx_Ta2i {
   int_ t0;
   int_ t1;
} _fx_Ta2i;

typedef struct _fx_T2Ta2iS {
   struct _fx_Ta2i t0;
   fx_str_t t1;
} _fx_T2Ta2iS;

typedef struct _fx_R9Ast__id_t {
   int_ m;
   int_ i;
   int_ j;
} _fx_R9Ast__id_t;

typedef struct _fx_R10Ast__loc_t {
   int_ m_idx;
   int_ line0;
   int_ col0;
   int_ line1;
   int_ col1;
} _fx_R10Ast__loc_t;

typedef struct _fx_T2Bi {
   bool t0;
   int_ t1;
} _fx_T2Bi;

typedef struct _fx_N12Ast__scope_t {
   int tag;
   union {
      int_ ScBlock;
      struct _fx_T2Bi ScLoop;
      int_ ScFold;
      int_ ScArrMap;
      int_ ScMap;
      int_ ScTry;
      struct _fx_R9Ast__id_t ScFun;
      struct _fx_R9Ast__id_t ScClass;
      struct _fx_R9Ast__id_t ScInterface;
      int_ ScModule;
   } u;
} _fx_N12Ast__scope_t;

typedef struct _fx_LN12Ast__scope_t_data_t {
   int_ rc;
   struct _fx_LN12Ast__scope_t_data_t* tl;
   struct _fx_N12Ast__scope_t hd;
} _fx_LN12Ast__scope_t_data_t, *_fx_LN12Ast__scope_t;

typedef struct _fx_N17Ast__fun_constr_t {
   int tag;
   union {
      int_ CtorVariant;
      struct _fx_R9Ast__id_t CtorFP;
      struct _fx_R9Ast__id_t CtorExn;
   } u;
} _fx_N17Ast__fun_constr_t;

typedef struct _fx_R16Ast__fun_flags_t {
   int_ fun_flag_pure;
   bool fun_flag_ccode;
   bool fun_flag_have_keywords;
   bool fun_flag_inline;
   bool fun_flag_nothrow;
   bool fun_flag_really_nothrow;
   bool fun_flag_private;
   struct _fx_N17Ast__fun_constr_t fun_flag_ctor;
   struct _fx_R9Ast__id_t fun_flag_method_of;
   bool fun_flag_uses_fv;
   bool fun_flag_recursive;
   bool fun_flag_instance;
} _fx_R16Ast__fun_flags_t;

typedef struct _fx_LR9Ast__id_t_data_t {
   int_ rc;
   struct _fx_LR9Ast__id_t_data_t* tl;
   struct _fx_R9Ast__id_t hd;
} _fx_LR9Ast__id_t_data_t, *_fx_LR9Ast__id_t;

typedef struct _fx_T2R9Ast__id_ti {
   struct _fx_R9Ast__id_t t0;
   int_ t1;
} _fx_T2R9Ast__id_ti;

typedef struct _fx_R16Ast__val_flags_t {
   bool val_flag_arg;
   bool val_flag_mutable;
   bool val_flag_temp;
   bool val_flag_tempref;
   bool val_flag_private;
   bool val_flag_subarray;
   bool val_flag_instance;
   struct _fx_T2R9Ast__id_ti val_flag_method;
   int_ val_flag_ctor;
   struct _fx_LN12Ast__scope_t_data_t* val_flag_global;
} _fx_R16Ast__val_flags_t;

typedef struct _fx_R17K_form__kdefval_t {
   struct _fx_R9Ast__id_t kv_name;
   fx_str_t kv_cname;
   struct _fx_N14K_form__ktyp_t_data_t* kv_typ;
   struct _fx_R16Ast__val_flags_t kv_flags;
   struct _fx_R10Ast__loc_t kv_loc;
} _fx_R17K_form__kdefval_t;

typedef struct _fx_T2R9Ast__id_tN14K_form__ktyp_t {
   struct _fx_R9Ast__id_t t0;
   struct _fx_N14K_form__ktyp_t_data_t* t1;
} _fx_T2R9Ast__id_tN14K_form__ktyp_t;

typedef struct _fx_LT2R9Ast__id_tN14K_form__ktyp_t_data_t {
   int_ rc;
   struct _fx_LT2R9Ast__id_tN14K_form__ktyp_t_data_t* tl;
   struct _fx_T2R9Ast__id_tN14K_form__ktyp_t hd;
} _fx_LT2R9Ast__id_tN14K_form__ktyp_t_data_t, *_fx_LT2R9Ast__id_tN14K_form__ktyp_t;

typedef struct _fx_R23K_form__kdefinterface_t {
   struct _fx_R9Ast__id_t ki_name;
   struct _fx_R9Ast__id_t ki_base;
   fx_str_t ki_cname;
   struct _fx_R9Ast__id_t ki_id;
   struct _fx_LT2R9Ast__id_tN14K_form__ktyp_t_data_t* ki_all_methods;
   struct _fx_LN12Ast__scope_t_data_t* ki_scope;
   struct _fx_R10Ast__loc_t ki_loc;
} _fx_R23K_form__kdefinterface_t;

typedef struct _fx_rR23K_form__kdefinterface_t_data_t {
   int_ rc;
   struct _fx_R23K_form__kdefinterface_t data;
} _fx_rR23K_form__kdefinterface_t_data_t, *_fx_rR23K_form__kdefinterface_t;

typedef struct _fx_R25K_form__kdefclosureinfo_t {
   struct _fx_R9Ast__id_t kci_arg;
   struct _fx_R9Ast__id_t kci_fcv_t;
   struct _fx_R9Ast__id_t kci_fp_typ;
   struct _fx_R9Ast__id_t kci_make_fp;
   struct _fx_R9Ast__id_t kci_wrap_f;
} _fx_R25K_form__kdefclosureinfo_t;

typedef struct _fx_R17K_form__kdeffun_t {
   struct _fx_R9Ast__id_t kf_name;
   fx_str_t kf_cname;
   struct _fx_LR9Ast__id_t_data_t* kf_params;
   struct _fx_N14K_form__ktyp_t_data_t* kf_rt;
   struct _fx_N14K_form__kexp_t_data_t* kf_body;
   struct _fx_R16Ast__fun_flags_t kf_flags;
   struct _fx_R25K_form__kdefclosureinfo_t kf_closure;
   struct _fx_LN12Ast__scope_t_data_t* kf_scope;
   struct _fx_R10Ast__loc_t kf_loc;
} _fx_R17K_form__kdeffun_t;

typedef struct _fx_rR17K_form__kdeffun_t_data_t {
   int_ rc;
   struct _fx_R17K_form__kdeffun_t data;
} _fx_rR17K_form__kdeffun_t_data_t, *_fx_rR17K_form__kdeffun_t;

typedef struct _fx_R17K_form__kdefexn_t {
   struct _fx_R9Ast__id_t ke_name;
   fx_str_t ke_cname;
   fx_str_t ke_base_cname;
   struct _fx_N14K_form__ktyp_t_data_t* ke_typ;
   bool ke_std;
   struct _fx_R9Ast__id_t ke_tag;
   struct _fx_R9Ast__id_t ke_make;
   struct _fx_LN12Ast__scope_t_data_t* ke_scope;
   struct _fx_R10Ast__loc_t ke_loc;
} _fx_R17K_form__kdefexn_t;

typedef struct _fx_rR17K_form__kdefexn_t_data_t {
   int_ rc;
   struct _fx_R17K_form__kdefexn_t data;
} _fx_rR17K_form__kdefexn_t_data_t, *_fx_rR17K_form__kdefexn_t;

typedef struct _fx_R17K_form__ktprops_t {
   bool ktp_complex;
   bool ktp_scalar;
   bool ktp_ptr;
   bool ktp_pass_by_ref;
   bool ktp_custom_free;
   bool ktp_custom_copy;
} _fx_R17K_form__ktprops_t;

typedef struct _fx_Nt6option1R17K_form__ktprops_t {
   int tag;
   union {
      struct _fx_R17K_form__ktprops_t Some;
   } u;
} _fx_Nt6option1R17K_form__ktprops_t;

typedef struct _fx_R16Ast__var_flags_t {
   int_ var_flag_class_from;
   bool var_flag_record;
   bool var_flag_recursive;
   bool var_flag_have_tag;
   bool var_flag_have_mutable;
   bool var_flag_opt;
   bool var_flag_instance;
} _fx_R16Ast__var_flags_t;

typedef struct _fx_LN14K_form__ktyp_t_data_t {
   int_ rc;
   struct _fx_LN14K_form__ktyp_t_data_t* tl;
   struct _fx_N14K_form__ktyp_t_data_t* hd;
} _fx_LN14K_form__ktyp_t_data_t, *_fx_LN14K_form__ktyp_t;

typedef struct _fx_T2R9Ast__id_tLR9Ast__id_t {
   struct _fx_R9Ast__id_t t0;
   struct _fx_LR9Ast__id_t_data_t* t1;
} _fx_T2R9Ast__id_tLR9Ast__id_t;

typedef struct _fx_LT2R9Ast__id_tLR9Ast__id_t_data_t {
   int_ rc;
   struct _fx_LT2R9Ast__id_tLR9Ast__id_t_data_t* tl;
   struct _fx_T2R9Ast__id_tLR9Ast__id_t hd;
} _fx_LT2R9Ast__id_tLR9Ast__id_t_data_t, *_fx_LT2R9Ast__id_tLR9Ast__id_t;

typedef struct _fx_R21K_form__kdefvariant_t {
   struct _fx_R9Ast__id_t kvar_name;
   fx_str_t kvar_cname;
   struct _fx_R9Ast__id_t kvar_proto;
   struct _fx_Nt6option1R17K_form__ktprops_t kvar_props;
   struct _fx_LN14K_form__ktyp_t_data_t* kvar_targs;
   struct _fx_LT2R9Ast__id_tN14K_form__ktyp_t_data_t* kvar_cases;
   struct _fx_LR9Ast__id_t_data_t* kvar_ctors;
   struct _fx_R16Ast__var_flags_t kvar_flags;
   struct _fx_LT2R9Ast__id_tLR9Ast__id_t_data_t* kvar_ifaces;
   struct _fx_LN12Ast__scope_t_data_t* kvar_scope;
   struct _fx_R10Ast__loc_t kvar_loc;
} _fx_R21K_form__kdefvariant_t;

typedef struct _fx_rR21K_form__kdefvariant_t_data_t {
   int_ rc;
   struct _fx_R21K_form__kdefvariant_t data;
} _fx_rR21K_form__kdefvariant_t_data_t, *_fx_rR21K_form__kdefvariant_t;

typedef struct _fx_R17K_form__kdeftyp_t {
   struct _fx_R9Ast__id_t kt_name;
   fx_str_t kt_cname;
   struct _fx_R9Ast__id_t kt_proto;
   struct _fx_Nt6option1R17K_form__ktprops_t kt_props;
   struct _fx_LN14K_form__ktyp_t_data_t* kt_targs;
   struct _fx_N14K_form__ktyp_t_data_t* kt_typ;
   struct _fx_LN12Ast__scope_t_data_t* kt_scope;
   struct _fx_R10Ast__loc_t kt_loc;
} _fx_R17K_form__kdeftyp_t;

typedef struct _fx_rR17K_form__kdeftyp_t_data_t {
   int_ rc;
   struct _fx_R17K_form__kdeftyp_t data;
} _fx_rR17K_form__kdeftyp_t_data_t, *_fx_rR17K_form__kdeftyp_t;

typedef struct _fx_R25K_form__kdefclosurevars_t {
   struct _fx_R9Ast__id_t kcv_name;
   fx_str_t kcv_cname;
   struct _fx_LT2R9Ast__id_tN14K_form__ktyp_t_data_t* kcv_freevars;
   struct _fx_LR9Ast__id_t_data_t* kcv_orig_freevars;
   struct _fx_LN12Ast__scope_t_data_t* kcv_scope;
   struct _fx_R10Ast__loc_t kcv_loc;
} _fx_R25K_form__kdefclosurevars_t;

typedef struct _fx_rR25K_form__kdefclosurevars_t_data_t {
   int_ rc;
   struct _fx_R25K_form__kdefclosurevars_t data;
} _fx_rR25K_form__kdefclosurevars_t_data_t, *_fx_rR25K_form__kdefclosurevars_t;

typedef struct _fx_N15K_form__kinfo_t {
   int tag;
   union {
      struct _fx_R17K_form__kdefval_t KVal;
      struct _fx_rR17K_form__kdeffun_t_data_t* KFun;
      struct _fx_rR17K_form__kdefexn_t_data_t* KExn;
      struct _fx_rR21K_form__kdefvariant_t_data_t* KVariant;
      struct _fx_rR25K_form__kdefclosurevars_t_data_t* KClosureVars;
      struct _fx_rR23K_form__kdefinterface_t_data_t* KInterface;
      struct _fx_rR17K_form__kdeftyp_t_data_t* KTyp;
   } u;
} _fx_N15K_form__kinfo_t;

typedef struct _fx_T3iA1SS {
   int_ t0;
   fx_arr_t t1;
   fx_str_t t2;
} _fx_T3iA1SS;

typedef struct _fx_Nt9Dynvec__t1S_data_t {
   int_ rc;
   union {
      struct _fx_T3iA1SS t;
   } u;
} _fx_Nt9Dynvec__t1S_data_t, *_fx_Nt9Dynvec__t1S;

typedef struct _fx_T2R10Ast__loc_tS {
   struct _fx_R10Ast__loc_t t0;
   fx_str_t t1;
} _fx_T2R10Ast__loc_tS;

typedef struct _fx_N12Ast__cmpop_t {
   int tag;
} _fx_N12Ast__cmpop_t;

typedef struct _fx_N13Ast__binary_t_data_t {
   int_ rc;
   int tag;
   union {
      struct _fx_N12Ast__cmpop_t OpCmp;
      struct _fx_N12Ast__cmpop_t OpDotCmp;
      struct _fx_N13Ast__binary_t_data_t* OpAugBinary;
   } u;
} _fx_N13Ast__binary_t_data_t, *_fx_N13Ast__binary_t;

typedef struct _fx_T2SR10Ast__loc_t {
   fx_str_t t0;
   struct _fx_R10Ast__loc_t t1;
} _fx_T2SR10Ast__loc_t;

typedef struct _fx_LT2SR10Ast__loc_t_data_t {
   int_ rc;
   struct _fx_LT2SR10Ast__loc_t_data_t* tl;
   struct _fx_T2SR10Ast__loc_t hd;
} _fx_LT2SR10Ast__loc_t_data_t, *_fx_LT2SR10Ast__loc_t;

typedef struct _fx_Li_data_t {
   int_ rc;
   struct _fx_Li_data_t* tl;
   int_ hd;
} _fx_Li_data_t, *_fx_Li;

typedef struct _fx_ri_data_t {
   int_ rc;
   int_ data;
} _fx_ri_data_t, *_fx_ri;

typedef struct _fx_T2il {
   int_ t0;
   int64_t t1;
} _fx_T2il;

typedef struct _fx_T2iq {
   int_ t0;
   uint64_t t1;
} _fx_T2iq;

typedef struct _fx_T2id {
   int_ t0;
   double t1;
} _fx_T2id;

typedef struct _fx_N14K_form__klit_t {
   int tag;
   union {
      int64_t KLitInt;
      struct _fx_T2il KLitSInt;
      struct _fx_T2iq KLitUInt;
      struct _fx_T2id KLitFloat;
      fx_str_t KLitString;
      char_ KLitChar;
      bool KLitBool;
      struct _fx_N14K_form__ktyp_t_data_t* KLitNil;
   } u;
} _fx_N14K_form__klit_t;

typedef struct _fx_N14K_form__atom_t {
   int tag;
   union {
      struct _fx_R9Ast__id_t AtomId;
      struct _fx_N14K_form__klit_t AtomLit;
   } u;
} _fx_N14K_form__atom_t;

typedef struct _fx_R22K_form__k_fold_callb_t {
   struct _fx_Nt6option1FPv3N14K_form__ktyp_tR10Ast__loc_tR22K_form__k_fold_callb_t_data_t* kcb_fold_ktyp;
   struct _fx_Nt6option1FPv2N14K_form__kexp_tR22K_form__k_fold_callb_t_data_t* kcb_fold_kexp;
   struct _fx_Nt6option1FPv3N14K_form__atom_tR10Ast__loc_tR22K_form__k_fold_callb_t_data_t* kcb_fold_atom;
} _fx_R22K_form__k_fold_callb_t;

typedef struct _fx_FPv3N14K_form__atom_tR10Ast__loc_tR22K_form__k_fold_callb_t {
   int (*fp)(struct _fx_N14K_form__atom_t*, struct _fx_R10Ast__loc_t*, struct _fx_R22K_form__k_fold_callb_t*, void*);
   fx_fcv_t* fcv;
} _fx_FPv3N14K_form__atom_tR10Ast__loc_tR22K_form__k_fold_callb_t;

typedef struct _fx_Nt6option1FPv3N14K_form__atom_tR10Ast__loc_tR22K_form__k_fold_callb_t_data_t {
   int_ rc;
   union {
      struct _fx_FPv3N14K_form__atom_tR10Ast__loc_tR22K_form__k_fold_callb_t Some;
   } u;
} _fx_Nt6option1FPv3N14K_form__atom_tR10Ast__loc_tR22K_form__k_fold_callb_t_data_t, *_fx_Nt6option1FPv3N14K_form__atom_tR10Ast__loc_tR22K_form__k_fold_callb_t;

typedef struct _fx_FPv2N14K_form__kexp_tR22K_form__k_fold_callb_t {
   int (*fp)(struct _fx_N14K_form__kexp_t_data_t*, struct _fx_R22K_form__k_fold_callb_t*, void*);
   fx_fcv_t* fcv;
} _fx_FPv2N14K_form__kexp_tR22K_form__k_fold_callb_t;

typedef struct _fx_Nt6option1FPv2N14K_form__kexp_tR22K_form__k_fold_callb_t_data_t {
   int_ rc;
   union {
      struct _fx_FPv2N14K_form__kexp_tR22K_form__k_fold_callb_t Some;
   } u;
} _fx_Nt6option1FPv2N14K_form__kexp_tR22K_form__k_fold_callb_t_data_t, *_fx_Nt6option1FPv2N14K_form__kexp_tR22K_form__k_fold_callb_t;

typedef struct _fx_FPv3N14K_form__ktyp_tR10Ast__loc_tR22K_form__k_fold_callb_t {
   int (*fp)(struct _fx_N14K_form__ktyp_t_data_t*, struct _fx_R10Ast__loc_t*, struct _fx_R22K_form__k_fold_callb_t*, void*);
   fx_fcv_t* fcv;
} _fx_FPv3N14K_form__ktyp_tR10Ast__loc_tR22K_form__k_fold_callb_t;

typedef struct _fx_Nt6option1FPv3N14K_form__ktyp_tR10Ast__loc_tR22K_form__k_fold_callb_t_data_t {
   int_ rc;
   union {
      struct _fx_FPv3N14K_form__ktyp_tR10Ast__loc_tR22K_form__k_fold_callb_t Some;
   } u;
} _fx_Nt6option1FPv3N14K_form__ktyp_tR10Ast__loc_tR22K_form__k_fold_callb_t_data_t, *_fx_Nt6option1FPv3N14K_form__ktyp_tR10Ast__loc_tR22K_form__k_fold_callb_t;

typedef struct _fx_R17K_form__k_callb_t {
   struct _fx_Nt6option1FPN14K_form__ktyp_t3N14K_form__ktyp_tR10Ast__loc_tR17K_form__k_callb_t_data_t* kcb_ktyp;
   struct _fx_Nt6option1FPN14K_form__kexp_t2N14K_form__kexp_tR17K_form__k_callb_t_data_t* kcb_kexp;
   struct _fx_Nt6option1FPN14K_form__atom_t3N14K_form__atom_tR10Ast__loc_tR17K_form__k_callb_t_data_t* kcb_atom;
} _fx_R17K_form__k_callb_t;

typedef struct _fx_FPN14K_form__atom_t3N14K_form__atom_tR10Ast__loc_tR17K_form__k_callb_t {
   int (*fp)(
      struct _fx_N14K_form__atom_t*, struct _fx_R10Ast__loc_t*, struct _fx_R17K_form__k_callb_t*, struct _fx_N14K_form__atom_t*,
         void*);
   fx_fcv_t* fcv;
} _fx_FPN14K_form__atom_t3N14K_form__atom_tR10Ast__loc_tR17K_form__k_callb_t;

typedef struct _fx_Nt6option1FPN14K_form__atom_t3N14K_form__atom_tR10Ast__loc_tR17K_form__k_callb_t_data_t {
   int_ rc;
   union {
      struct _fx_FPN14K_form__atom_t3N14K_form__atom_tR10Ast__loc_tR17K_form__k_callb_t Some;
   } u;
} _fx_Nt6option1FPN14K_form__atom_t3N14K_form__atom_tR10Ast__loc_tR17K_form__k_callb_t_data_t, *_fx_Nt6option1FPN14K_form__atom_t3N14K_form__atom_tR10Ast__loc_tR17K_form__k_callb_t;

typedef struct _fx_FPN14K_form__kexp_t2N14K_form__kexp_tR17K_form__k_callb_t {
   int (*fp)(
      struct _fx_N14K_form__kexp_t_data_t*, struct _fx_R17K_form__k_callb_t*, struct _fx_N14K_form__kexp_t_data_t**, void*);
   fx_fcv_t* fcv;
} _fx_FPN14K_form__kexp_t2N14K_form__kexp_tR17K_form__k_callb_t;

typedef struct _fx_Nt6option1FPN14K_form__kexp_t2N14K_form__kexp_tR17K_form__k_callb_t_data_t {
   int_ rc;
   union {
      struct _fx_FPN14K_form__kexp_t2N14K_form__kexp_tR17K_form__k_callb_t Some;
   } u;
} _fx_Nt6option1FPN14K_form__kexp_t2N14K_form__kexp_tR17K_form__k_callb_t_data_t, *_fx_Nt6option1FPN14K_form__kexp_t2N14K_form__kexp_tR17K_form__k_callb_t;

typedef struct _fx_FPN14K_form__ktyp_t3N14K_form__ktyp_tR10Ast__loc_tR17K_form__k_callb_t {
   int (*fp)(
      struct _fx_N14K_form__ktyp_t_data_t*, struct _fx_R10Ast__loc_t*, struct _fx_R17K_form__k_callb_t*,
         struct _fx_N14K_form__ktyp_t_data_t**, void*);
   fx_fcv_t* fcv;
} _fx_FPN14K_form__ktyp_t3N14K_form__ktyp_tR10Ast__loc_tR17K_form__k_callb_t;

typedef struct _fx_Nt6option1FPN14K_form__ktyp_t3N14K_form__ktyp_tR10Ast__loc_tR17K_form__k_callb_t_data_t {
   int_ rc;
   union {
      struct _fx_FPN14K_form__ktyp_t3N14K_form__ktyp_tR10Ast__loc_tR17K_form__k_callb_t Some;
   } u;
} _fx_Nt6option1FPN14K_form__ktyp_t3N14K_form__ktyp_tR10Ast__loc_tR17K_form__k_callb_t_data_t, *_fx_Nt6option1FPN14K_form__ktyp_t3N14K_form__ktyp_tR10Ast__loc_tR17K_form__k_callb_t;

typedef struct _fx_Nt6option1N14K_form__atom_t {
   int tag;
   union {
      struct _fx_N14K_form__atom_t Some;
   } u;
} _fx_Nt6option1N14K_form__atom_t;

typedef struct _fx_LN14K_form__kexp_t_data_t {
   int_ rc;
   struct _fx_LN14K_form__kexp_t_data_t* tl;
   struct _fx_N14K_form__kexp_t_data_t* hd;
} _fx_LN14K_form__kexp_t_data_t, *_fx_LN14K_form__kexp_t;

typedef struct _fx_T2BN14K_form__atom_t {
   bool t0;
   struct _fx_N14K_form__atom_t t1;
} _fx_T2BN14K_form__atom_t;

typedef struct _fx_LT2BN14K_form__atom_t_data_t {
   int_ rc;
   struct _fx_LT2BN14K_form__atom_t_data_t* tl;
   struct _fx_T2BN14K_form__atom_t hd;
} _fx_LT2BN14K_form__atom_t_data_t, *_fx_LT2BN14K_form__atom_t;

typedef struct _fx_N12Ast__unary_t {
   int tag;
} _fx_N12Ast__unary_t;

typedef struct _fx_N12Ast__sctyp_t {
   int tag;
} _fx_N12Ast__sctyp_t;

typedef struct _fx_N13Ast__intrin_t {
   int tag;
   union {
      struct _fx_R9Ast__id_t IntrinMath;
      struct _fx_N12Ast__sctyp_t IntrinSaturate;
   } u;
} _fx_N13Ast__intrin_t;

typedef struct _fx_N15Ast__for_make_t {
   int tag;
} _fx_N15Ast__for_make_t;

typedef struct _fx_R16Ast__for_flags_t {
   bool for_flag_parallel;
   struct _fx_N15Ast__for_make_t for_flag_make;
   bool for_flag_unzip;
   bool for_flag_fold;
   bool for_flag_nested;
} _fx_R16Ast__for_flags_t;

typedef struct _fx_N13Ast__border_t {
   int tag;
} _fx_N13Ast__border_t;

typedef struct _fx_N18Ast__interpolate_t {
   int tag;
} _fx_N18Ast__interpolate_t;

typedef struct _fx_T2LN14K_form__ktyp_tN14K_form__ktyp_t {
   struct _fx_LN14K_form__ktyp_t_data_t* t0;
   struct _fx_N14K_form__ktyp_t_data_t* t1;
} _fx_T2LN14K_form__ktyp_tN14K_form__ktyp_t;

typedef struct _fx_T2R9Ast__id_tLT2R9Ast__id_tN14K_form__ktyp_t {
   struct _fx_R9Ast__id_t t0;
   struct _fx_LT2R9Ast__id_tN14K_form__ktyp_t_data_t* t1;
} _fx_T2R9Ast__id_tLT2R9Ast__id_tN14K_form__ktyp_t;

typedef struct _fx_T2iN14K_form__ktyp_t {
   int_ t0;
   struct _fx_N14K_form__ktyp_t_data_t* t1;
} _fx_T2iN14K_form__ktyp_t;

typedef struct _fx_N14K_form__ktyp_t_data_t {
   int_ rc;
   int tag;
   union {
      int_ KTypSInt;
      int_ KTypUInt;
      int_ KTypFloat;
      struct _fx_N14K_form__ktyp_t_data_t* KTypRawPointer;
      struct _fx_T2LN14K_form__ktyp_tN14K_form__ktyp_t KTypFun;
      struct _fx_LN14K_form__ktyp_t_data_t* KTypTuple;
      struct _fx_T2R9Ast__id_tLT2R9Ast__id_tN14K_form__ktyp_t KTypRecord;
      struct _fx_R9Ast__id_t KTypName;
      struct _fx_T2iN14K_form__ktyp_t KTypArray;
      struct _fx_N14K_form__ktyp_t_data_t* KTypVector;
      struct _fx_N14K_form__ktyp_t_data_t* KTypList;
      struct _fx_N14K_form__ktyp_t_data_t* KTypRef;
   } u;
} _fx_N14K_form__ktyp_t_data_t, *_fx_N14K_form__ktyp_t;

typedef struct _fx_Ta3N14K_form__atom_t {
   struct _fx_N14K_form__atom_t t0;
   struct _fx_N14K_form__atom_t t1;
   struct _fx_N14K_form__atom_t t2;
} _fx_Ta3N14K_form__atom_t;

typedef struct _fx_N13K_form__dom_t {
   int tag;
   union {
      struct _fx_N14K_form__atom_t DomainElem;
      struct _fx_N14K_form__atom_t DomainFast;
      struct _fx_Ta3N14K_form__atom_t DomainRange;
   } u;
} _fx_N13K_form__dom_t;

typedef struct _fx_T2Nt6option1N14K_form__atom_tR10Ast__loc_t {
   struct _fx_Nt6option1N14K_form__atom_t t0;
   struct _fx_R10Ast__loc_t t1;
} _fx_T2Nt6option1N14K_form__atom_tR10Ast__loc_t;

typedef struct _fx_T2N14K_form__ktyp_tR10Ast__loc_t {
   struct _fx_N14K_form__ktyp_t_data_t* t0;
   struct _fx_R10Ast__loc_t t1;
} _fx_T2N14K_form__ktyp_tR10Ast__loc_t;

typedef struct _fx_T2N14K_form__atom_tT2N14K_form__ktyp_tR10Ast__loc_t {
   struct _fx_N14K_form__atom_t t0;
   struct _fx_T2N14K_form__ktyp_tR10Ast__loc_t t1;
} _fx_T2N14K_form__atom_tT2N14K_form__ktyp_tR10Ast__loc_t;

typedef struct _fx_T4N13Ast__binary_tN14K_form__atom_tN14K_form__atom_tT2N14K_form__ktyp_tR10Ast__loc_t {
   struct _fx_N13Ast__binary_t_data_t* t0;
   struct _fx_N14K_form__atom_t t1;
   struct _fx_N14K_form__atom_t t2;
   struct _fx_T2N14K_form__ktyp_tR10Ast__loc_t t3;
} _fx_T4N13Ast__binary_tN14K_form__atom_tN14K_form__atom_tT2N14K_form__ktyp_tR10Ast__loc_t;

typedef struct _fx_T3N12Ast__unary_tN14K_form__atom_tT2N14K_form__ktyp_tR10Ast__loc_t {
   struct _fx_N12Ast__unary_t t0;
   struct _fx_N14K_form__atom_t t1;
   struct _fx_T2N14K_form__ktyp_tR10Ast__loc_t t2;
} _fx_T3N12Ast__unary_tN14K_form__atom_tT2N14K_form__ktyp_tR10Ast__loc_t;

typedef struct _fx_LN14K_form__atom_t_data_t {
   int_ rc;
   struct _fx_LN14K_form__atom_t_data_t* tl;
   struct _fx_N14K_form__atom_t hd;
} _fx_LN14K_form__atom_t_data_t, *_fx_LN14K_form__atom_t;

typedef struct _fx_T3N13Ast__intrin_tLN14K_form__atom_tT2N14K_form__ktyp_tR10Ast__loc_t {
   struct _fx_N13Ast__intrin_t t0;
   struct _fx_LN14K_form__atom_t_data_t* t1;
   struct _fx_T2N14K_form__ktyp_tR10Ast__loc_t t2;
} _fx_T3N13Ast__intrin_tLN14K_form__atom_tT2N14K_form__ktyp_tR10Ast__loc_t;

typedef struct _fx_T2R9Ast__id_tN14K_form__kexp_t {
   struct _fx_R9Ast__id_t t0;
   struct _fx_N14K_form__kexp_t_data_t* t1;
} _fx_T2R9Ast__id_tN14K_form__kexp_t;

typedef struct _fx_T2LN14K_form__kexp_tT2N14K_form__ktyp_tR10Ast__loc_t {
   struct _fx_LN14K_form__kexp_t_data_t* t0;
   struct _fx_T2N14K_form__ktyp_tR10Ast__loc_t t1;
} _fx_T2LN14K_form__kexp_tT2N14K_form__ktyp_tR10Ast__loc_t;

typedef struct _fx_T4N14K_form__kexp_tN14K_form__kexp_tN14K_form__kexp_tT2N14K_form__ktyp_tR10Ast__loc_t {
   struct _fx_N14K_form__kexp_t_data_t* t0;
   struct _fx_N14K_form__kexp_t_data_t* t1;
   struct _fx_N14K_form__kexp_t_data_t* t2;
   struct _fx_T2N14K_form__ktyp_tR10Ast__loc_t t3;
} _fx_T4N14K_form__kexp_tN14K_form__kexp_tN14K_form__kexp_tT2N14K_form__ktyp_tR10Ast__loc_t;

typedef struct _fx_T3R9Ast__id_tLN14K_form__atom_tT2N14K_form__ktyp_tR10Ast__loc_t {
   struct _fx_R9Ast__id_t t0;
   struct _fx_LN14K_form__atom_t_data_t* t1;
   struct _fx_T2N14K_form__ktyp_tR10Ast__loc_t t2;
} _fx_T3R9Ast__id_tLN14K_form__atom_tT2N14K_form__ktyp_tR10Ast__loc_t;

typedef struct _fx_T4R9Ast__id_tiLN14K_form__atom_tT2N14K_form__ktyp_tR10Ast__loc_t {
   struct _fx_R9Ast__id_t t0;
   int_ t1;
   struct _fx_LN14K_form__atom_t_data_t* t2;
   struct _fx_T2N14K_form__ktyp_tR10Ast__loc_t t3;
} _fx_T4R9Ast__id_tiLN14K_form__atom_tT2N14K_form__ktyp_tR10Ast__loc_t;

typedef struct _fx_T2LN14K_form__atom_tT2N14K_form__ktyp_tR10Ast__loc_t {
   struct _fx_LN14K_form__atom_t_data_t* t0;
   struct _fx_T2N14K_form__ktyp_tR10Ast__loc_t t1;
} _fx_T2LN14K_form__atom_tT2N14K_form__ktyp_tR10Ast__loc_t;

typedef struct _fx_T4R9Ast__id_tR9Ast__id_tLN14K_form__atom_tT2N14K_form__ktyp_tR10Ast__loc_t {
   struct _fx_R9Ast__id_t t0;
   struct _fx_R9Ast__id_t t1;
   struct _fx_LN14K_form__atom_t_data_t* t2;
   struct _fx_T2N14K_form__ktyp_tR10Ast__loc_t t3;
} _fx_T4R9Ast__id_tR9Ast__id_tLN14K_form__atom_tT2N14K_form__ktyp_tR10Ast__loc_t;

typedef struct _fx_LLT2BN14K_form__atom_t_data_t {
   int_ rc;
   struct _fx_LLT2BN14K_form__atom_t_data_t* tl;
   struct _fx_LT2BN14K_form__atom_t_data_t* hd;
} _fx_LLT2BN14K_form__atom_t_data_t, *_fx_LLT2BN14K_form__atom_t;

typedef struct _fx_T3BLLT2BN14K_form__atom_tT2N14K_form__ktyp_tR10Ast__loc_t {
   bool t0;
   struct _fx_LLT2BN14K_form__atom_t_data_t* t1;
   struct _fx_T2N14K_form__ktyp_tR10Ast__loc_t t2;
} _fx_T3BLLT2BN14K_form__atom_tT2N14K_form__ktyp_tR10Ast__loc_t;

typedef struct _fx_T2LT2BN14K_form__atom_tT2N14K_form__ktyp_tR10Ast__loc_t {
   struct _fx_LT2BN14K_form__atom_t_data_t* t0;
   struct _fx_T2N14K_form__ktyp_tR10Ast__loc_t t1;
} _fx_T2LT2BN14K_form__atom_tT2N14K_form__ktyp_tR10Ast__loc_t;

typedef struct _fx_LN13K_form__dom_t_data_t {
   int_ rc;
   struct _fx_LN13K_form__dom_t_data_t* tl;
   struct _fx_N13K_form__dom_t hd;
} _fx_LN13K_form__dom_t_data_t, *_fx_LN13K_form__dom_t;

typedef struct _fx_T5N14K_form__atom_tN13Ast__border_tN18Ast__interpolate_tLN13K_form__dom_tT2N14K_form__ktyp_tR10Ast__loc_t {
   struct _fx_N14K_form__atom_t t0;
   struct _fx_N13Ast__border_t t1;
   struct _fx_N18Ast__interpolate_t t2;
   struct _fx_LN13K_form__dom_t_data_t* t3;
   struct _fx_T2N14K_form__ktyp_tR10Ast__loc_t t4;
} _fx_T5N14K_form__atom_tN13Ast__border_tN18Ast__interpolate_tLN13K_form__dom_tT2N14K_form__ktyp_tR10Ast__loc_t;

typedef struct _fx_T3R9Ast__id_tiT2N14K_form__ktyp_tR10Ast__loc_t {
   struct _fx_R9Ast__id_t t0;
   int_ t1;
   struct _fx_T2N14K_form__ktyp_tR10Ast__loc_t t2;
} _fx_T3R9Ast__id_tiT2N14K_form__ktyp_tR10Ast__loc_t;

typedef struct _fx_T3R9Ast__id_tN14K_form__atom_tR10Ast__loc_t {
   struct _fx_R9Ast__id_t t0;
   struct _fx_N14K_form__atom_t t1;
   struct _fx_R10Ast__loc_t t2;
} _fx_T3R9Ast__id_tN14K_form__atom_tR10Ast__loc_t;

typedef struct _fx_T2LN14K_form__kexp_tN14K_form__kexp_t {
   struct _fx_LN14K_form__kexp_t_data_t* t0;
   struct _fx_N14K_form__kexp_t_data_t* t1;
} _fx_T2LN14K_form__kexp_tN14K_form__kexp_t;

typedef struct _fx_LT2LN14K_form__kexp_tN14K_form__kexp_t_data_t {
   int_ rc;
   struct _fx_LT2LN14K_form__kexp_tN14K_form__kexp_t_data_t* tl;
   struct _fx_T2LN14K_form__kexp_tN14K_form__kexp_t hd;
} _fx_LT2LN14K_form__kexp_tN14K_form__kexp_t_data_t, *_fx_LT2LN14K_form__kexp_tN14K_form__kexp_t;

typedef struct _fx_T2LT2LN14K_form__kexp_tN14K_form__kexp_tT2N14K_form__ktyp_tR10Ast__loc_t {
   struct _fx_LT2LN14K_form__kexp_tN14K_form__kexp_t_data_t* t0;
   struct _fx_T2N14K_form__ktyp_tR10Ast__loc_t t1;
} _fx_T2LT2LN14K_form__kexp_tN14K_form__kexp_tT2N14K_form__ktyp_tR10Ast__loc_t;

typedef struct _fx_T3N14K_form__kexp_tN14K_form__kexp_tT2N14K_form__ktyp_tR10Ast__loc_t {
   struct _fx_N14K_form__kexp_t_data_t* t0;
   struct _fx_N14K_form__kexp_t_data_t* t1;
   struct _fx_T2N14K_form__ktyp_tR10Ast__loc_t t2;
} _fx_T3N14K_form__kexp_tN14K_form__kexp_tT2N14K_form__ktyp_tR10Ast__loc_t;

typedef struct _fx_T3R9Ast__id_tBR10Ast__loc_t {
   struct _fx_R9Ast__id_t t0;
   bool t1;
   struct _fx_R10Ast__loc_t t2;
} _fx_T3R9Ast__id_tBR10Ast__loc_t;

typedef struct _fx_T3N14K_form__atom_tN14K_form__ktyp_tR10Ast__loc_t {
   struct _fx_N14K_form__atom_t t0;
   struct _fx_N14K_form__ktyp_t_data_t* t1;
   struct _fx_R10Ast__loc_t t2;
} _fx_T3N14K_form__atom_tN14K_form__ktyp_tR10Ast__loc_t;

typedef struct _fx_T2R9Ast__id_tN13K_form__dom_t {
   struct _fx_R9Ast__id_t t0;
   struct _fx_N13K_form__dom_t t1;
} _fx_T2R9Ast__id_tN13K_form__dom_t;

typedef struct _fx_LT2R9Ast__id_tN13K_form__dom_t_data_t {
   int_ rc;
   struct _fx_LT2R9Ast__id_tN13K_form__dom_t_data_t* tl;
   struct _fx_T2R9Ast__id_tN13K_form__dom_t hd;
} _fx_LT2R9Ast__id_tN13K_form__dom_t_data_t, *_fx_LT2R9Ast__id_tN13K_form__dom_t;

typedef struct _fx_T3N14K_form__kexp_tLT2R9Ast__id_tN13K_form__dom_tLR9Ast__id_t {
   struct _fx_N14K_form__kexp_t_data_t* t0;
   struct _fx_LT2R9Ast__id_tN13K_form__dom_t_data_t* t1;
   struct _fx_LR9Ast__id_t_data_t* t2;
} _fx_T3N14K_form__kexp_tLT2R9Ast__id_tN13K_form__dom_tLR9Ast__id_t;

typedef struct _fx_LT3N14K_form__kexp_tLT2R9Ast__id_tN13K_form__dom_tLR9Ast__id_t_data_t {
   int_ rc;
   struct _fx_LT3N14K_form__kexp_tLT2R9Ast__id_tN13K_form__dom_tLR9Ast__id_t_data_t* tl;
   struct _fx_T3N14K_form__kexp_tLT2R9Ast__id_tN13K_form__dom_tLR9Ast__id_t hd;
} _fx_LT3N14K_form__kexp_tLT2R9Ast__id_tN13K_form__dom_tLR9Ast__id_t_data_t, *_fx_LT3N14K_form__kexp_tLT2R9Ast__id_tN13K_form__dom_tLR9Ast__id_t;

typedef struct _fx_T4LT3N14K_form__kexp_tLT2R9Ast__id_tN13K_form__dom_tLR9Ast__id_tN14K_form__kexp_tR16Ast__for_flags_tT2N14K_form__ktyp_tR10Ast__loc_t {
   struct _fx_LT3N14K_form__kexp_tLT2R9Ast__id_tN13K_form__dom_tLR9Ast__id_t_data_t* t0;
   struct _fx_N14K_form__kexp_t_data_t* t1;
   struct _fx_R16Ast__for_flags_t t2;
   struct _fx_T2N14K_form__ktyp_tR10Ast__loc_t t3;
} _fx_T4LT3N14K_form__kexp_tLT2R9Ast__id_tN13K_form__dom_tLR9Ast__id_tN14K_form__kexp_tR16Ast__for_flags_tT2N14K_form__ktyp_tR10Ast__loc_t;

typedef struct _fx_T5LT2R9Ast__id_tN13K_form__dom_tLR9Ast__id_tN14K_form__kexp_tR16Ast__for_flags_tR10Ast__loc_t {
   struct _fx_LT2R9Ast__id_tN13K_form__dom_t_data_t* t0;
   struct _fx_LR9Ast__id_t_data_t* t1;
   struct _fx_N14K_form__kexp_t_data_t* t2;
   struct _fx_R16Ast__for_flags_t t3;
   struct _fx_R10Ast__loc_t t4;
} _fx_T5LT2R9Ast__id_tN13K_form__dom_tLR9Ast__id_tN14K_form__kexp_tR16Ast__for_flags_tR10Ast__loc_t;

typedef struct _fx_T3N14K_form__kexp_tN14K_form__kexp_tR10Ast__loc_t {
   struct _fx_N14K_form__kexp_t_data_t* t0;
   struct _fx_N14K_form__kexp_t_data_t* t1;
   struct _fx_R10Ast__loc_t t2;
} _fx_T3N14K_form__kexp_tN14K_form__kexp_tR10Ast__loc_t;

typedef struct _fx_T2ST2N14K_form__ktyp_tR10Ast__loc_t {
   fx_str_t t0;
   struct _fx_T2N14K_form__ktyp_tR10Ast__loc_t t1;
} _fx_T2ST2N14K_form__ktyp_tR10Ast__loc_t;

typedef struct _fx_T3R9Ast__id_tN14K_form__kexp_tR10Ast__loc_t {
   struct _fx_R9Ast__id_t t0;
   struct _fx_N14K_form__kexp_t_data_t* t1;
   struct _fx_R10Ast__loc_t t2;
} _fx_T3R9Ast__id_tN14K_form__kexp_tR10Ast__loc_t;

typedef struct _fx_N14K_form__kexp_t_data_t {
   int_ rc;
   int tag;
   union {
      struct _fx_R10Ast__loc_t KExpNop;
      struct _fx_R10Ast__loc_t KExpBreak;
      struct _fx_R10Ast__loc_t KExpContinue;
      struct _fx_T2Nt6option1N14K_form__atom_tR10Ast__loc_t KExpReturn;
      struct _fx_T2N14K_form__atom_tT2N14K_form__ktyp_tR10Ast__loc_t KExpAtom;
      struct _fx_T4N13Ast__binary_tN14K_form__atom_tN14K_form__atom_tT2N14K_form__ktyp_tR10Ast__loc_t KExpBinary;
      struct _fx_T3N12Ast__unary_tN14K_form__atom_tT2N14K_form__ktyp_tR10Ast__loc_t KExpUnary;
      struct _fx_T3N13Ast__intrin_tLN14K_form__atom_tT2N14K_form__ktyp_tR10Ast__loc_t KExpIntrin;
      struct _fx_T2R9Ast__id_tN14K_form__kexp_t KExpSync;
      struct _fx_T2LN14K_form__kexp_tT2N14K_form__ktyp_tR10Ast__loc_t KExpSeq;
      struct _fx_T4N14K_form__kexp_tN14K_form__kexp_tN14K_form__kexp_tT2N14K_form__ktyp_tR10Ast__loc_t KExpIf;
      struct _fx_T3R9Ast__id_tLN14K_form__atom_tT2N14K_form__ktyp_tR10Ast__loc_t KExpCall;
      struct _fx_T4R9Ast__id_tiLN14K_form__atom_tT2N14K_form__ktyp_tR10Ast__loc_t KExpICall;
      struct _fx_T2LN14K_form__atom_tT2N14K_form__ktyp_tR10Ast__loc_t KExpMkTuple;
      struct _fx_T2LN14K_form__atom_tT2N14K_form__ktyp_tR10Ast__loc_t KExpMkRecord;
      struct _fx_T4R9Ast__id_tR9Ast__id_tLN14K_form__atom_tT2N14K_form__ktyp_tR10Ast__loc_t KExpMkClosure;
      struct _fx_T3BLLT2BN14K_form__atom_tT2N14K_form__ktyp_tR10Ast__loc_t KExpMkArray;
      struct _fx_T2LT2BN14K_form__atom_tT2N14K_form__ktyp_tR10Ast__loc_t KExpMkVector;
      struct _fx_T5N14K_form__atom_tN13Ast__border_tN18Ast__interpolate_tLN13K_form__dom_tT2N14K_form__ktyp_tR10Ast__loc_t
         KExpAt;
      struct _fx_T3R9Ast__id_tiT2N14K_form__ktyp_tR10Ast__loc_t KExpMem;
      struct _fx_T3R9Ast__id_tN14K_form__atom_tR10Ast__loc_t KExpAssign;
      struct _fx_T2LT2LN14K_form__kexp_tN14K_form__kexp_tT2N14K_form__ktyp_tR10Ast__loc_t KExpMatch;
      struct _fx_T3N14K_form__kexp_tN14K_form__kexp_tT2N14K_form__ktyp_tR10Ast__loc_t KExpTryCatch;
      struct _fx_T3R9Ast__id_tBR10Ast__loc_t KExpThrow;
      struct _fx_T3N14K_form__atom_tN14K_form__ktyp_tR10Ast__loc_t KExpCast;
      struct _fx_T4LT3N14K_form__kexp_tLT2R9Ast__id_tN13K_form__dom_tLR9Ast__id_tN14K_form__kexp_tR16Ast__for_flags_tT2N14K_form__ktyp_tR10Ast__loc_t
         KExpMap;
      struct _fx_T5LT2R9Ast__id_tN13K_form__dom_tLR9Ast__id_tN14K_form__kexp_tR16Ast__for_flags_tR10Ast__loc_t KExpFor;
      struct _fx_T3N14K_form__kexp_tN14K_form__kexp_tR10Ast__loc_t KExpWhile;
      struct _fx_T3N14K_form__kexp_tN14K_form__kexp_tR10Ast__loc_t KExpDoWhile;
      struct _fx_T2ST2N14K_form__ktyp_tR10Ast__loc_t KExpCCode;
      struct _fx_T3R9Ast__id_tN14K_form__kexp_tR10Ast__loc_t KDefVal;
      struct _fx_rR17K_form__kdeffun_t_data_t* KDefFun;
      struct _fx_rR17K_form__kdefexn_t_data_t* KDefExn;
      struct _fx_rR21K_form__kdefvariant_t_data_t* KDefVariant;
      struct _fx_rR23K_form__kdefinterface_t_data_t* KDefInterface;
      struct _fx_rR17K_form__kdeftyp_t_data_t* KDefTyp;
      struct _fx_rR25K_form__kdefclosurevars_t_data_t* KDefClosureVars;
   } u;
} _fx_N14K_form__kexp_t_data_t, *_fx_N14K_form__kexp_t;

typedef struct _fx_R14Ast__pragmas_t {
   bool pragma_cpp;
   struct _fx_LT2SR10Ast__loc_t_data_t* pragma_clibs;
} _fx_R14Ast__pragmas_t;

typedef struct _fx_R17K_form__kmodule_t {
   struct _fx_R9Ast__id_t km_name;
   int_ km_idx;
   int_ km_toposort_idx;
   fx_str_t km_cname;
   struct _fx_LN14K_form__kexp_t_data_t* km_top;
   struct _fx_Li_data_t* km_deps;
   bool km_skip;
   bool km_main;
   struct _fx_R14Ast__pragmas_t km_pragmas;
} _fx_R17K_form__kmodule_t;

typedef struct _fx_LR17K_form__kmodule_t_data_t {
   int_ rc;
   struct _fx_LR17K_form__kmodule_t_data_t* tl;
   struct _fx_R17K_form__kmodule_t hd;
} _fx_LR17K_form__kmodule_t_data_t, *_fx_LR17K_form__kmodule_t;

typedef struct _fx_Nt6option1LN12Ast__scope_t {
   int tag;
   union {
      struct _fx_LN12Ast__scope_t_data_t* Some;
   } u;
} _fx_Nt6option1LN12Ast__scope_t;

typedef struct _fx_Nt6option1R9Ast__id_t {
   int tag;
   union {
      struct _fx_R9Ast__id_t Some;
   } u;
} _fx_Nt6option1R9Ast__id_t;

typedef struct _fx_Rt20Hashmap__hashentry_t2ii {
   uint64_t hv;
   int_ key;
   int_ data;
} _fx_Rt20Hashmap__hashentry_t2ii;

typedef struct _fx_Rt20Hashmap__hashentry_t2SR9Ast__id_t {
   uint64_t hv;
   fx_str_t key;
   struct _fx_R9Ast__id_t data;
} _fx_Rt20Hashmap__hashentry_t2SR9Ast__id_t;

typedef struct _fx_T6Rt20Hashmap__hashentry_t2iiiiiA1iA1Rt20Hashmap__hashentry_t2ii {
   struct _fx_Rt20Hashmap__hashentry_t2ii t0;
   int_ t1;
   int_ t2;
   int_ t3;
   fx_arr_t t4;
   fx_arr_t t5;
} _fx_T6Rt20Hashmap__hashentry_t2iiiiiA1iA1Rt20Hashmap__hashentry_t2ii;

typedef struct _fx_Nt10Hashmap__t2ii_data_t {
   int_ rc;
   union {
      struct _fx_T6Rt20Hashmap__hashentry_t2iiiiiA1iA1Rt20Hashmap__hashentry_t2ii t;
   } u;
} _fx_Nt10Hashmap__t2ii_data_t, *_fx_Nt10Hashmap__t2ii;

typedef struct _fx_T6Rt20Hashmap__hashentry_t2SR9Ast__id_tiiiA1iA1Rt20Hashmap__hashentry_t2SR9Ast__id_t {
   struct _fx_Rt20Hashmap__hashentry_t2SR9Ast__id_t t0;
   int_ t1;
   int_ t2;
   int_ t3;
   fx_arr_t t4;
   fx_arr_t t5;
} _fx_T6Rt20Hashmap__hashentry_t2SR9Ast__id_tiiiA1iA1Rt20Hashmap__hashentry_t2SR9Ast__id_t;

typedef struct _fx_Nt10Hashmap__t2SR9Ast__id_t_data_t {
   int_ rc;
   union {
      struct _fx_T6Rt20Hashmap__hashentry_t2SR9Ast__id_tiiiA1iA1Rt20Hashmap__hashentry_t2SR9Ast__id_t t;
   } u;
} _fx_Nt10Hashmap__t2SR9Ast__id_t_data_t, *_fx_Nt10Hashmap__t2SR9Ast__id_t;

typedef struct _fx_Ta2S {
   fx_str_t t0;
   fx_str_t t1;
} _fx_Ta2S;

typedef struct _fx_rLN14K_form__kexp_t_data_t {
   int_ rc;
   struct _fx_LN14K_form__kexp_t_data_t* data;
} _fx_rLN14K_form__kexp_t_data_t, *_fx_rLN14K_form__kexp_t;

typedef struct _fx_FPN14K_form__ktyp_t7R9Ast__id_tR10Ast__loc_tR17K_form__k_callb_trirLN14K_form__kexp_tBNt10Hashmap__t2SR9Ast__id_t {
   int (*fp)(
      struct _fx_R9Ast__id_t*, struct _fx_R10Ast__loc_t*, struct _fx_R17K_form__k_callb_t*, struct _fx_ri_data_t*,
         struct _fx_rLN14K_form__kexp_t_data_t*, bool, struct _fx_Nt10Hashmap__t2SR9Ast__id_t_data_t*,
         struct _fx_N14K_form__ktyp_t_data_t**, void*);
   fx_fcv_t* fcv;
} _fx_FPN14K_form__ktyp_t7R9Ast__id_tR10Ast__loc_tR17K_form__k_callb_trirLN14K_form__kexp_tBNt10Hashmap__t2SR9Ast__id_t;

typedef struct _fx_FPN14K_form__ktyp_t7N14K_form__ktyp_tR10Ast__loc_tR17K_form__k_callb_trirLN14K_form__kexp_tBNt10Hashmap__t2SR9Ast__id_t {
   int (*fp)(
      struct _fx_N14K_form__ktyp_t_data_t*, struct _fx_R10Ast__loc_t*, struct _fx_R17K_form__k_callb_t*, struct _fx_ri_data_t*,
         struct _fx_rLN14K_form__kexp_t_data_t*, bool, struct _fx_Nt10Hashmap__t2SR9Ast__id_t_data_t*,
         struct _fx_N14K_form__ktyp_t_data_t**, void*);
   fx_fcv_t* fcv;
} _fx_FPN14K_form__ktyp_t7N14K_form__ktyp_tR10Ast__loc_tR17K_form__k_callb_trirLN14K_form__kexp_tBNt10Hashmap__t2SR9Ast__id_t;

typedef struct _fx_FPv8LT2R9Ast__id_tN13K_form__dom_tLR9Ast__id_tR10Ast__loc_tR17K_form__k_callb_trirLN14K_form__kexp_tBNt10Hashmap__t2SR9Ast__id_t {
   int (*fp)(
      struct _fx_LT2R9Ast__id_tN13K_form__dom_t_data_t*, struct _fx_LR9Ast__id_t_data_t*, struct _fx_R10Ast__loc_t*,
         struct _fx_R17K_form__k_callb_t*, struct _fx_ri_data_t*, struct _fx_rLN14K_form__kexp_t_data_t*, bool,
         struct _fx_Nt10Hashmap__t2SR9Ast__id_t_data_t*, void*);
   fx_fcv_t* fcv;
} _fx_FPv8LT2R9Ast__id_tN13K_form__dom_tLR9Ast__id_tR10Ast__loc_tR17K_form__k_callb_trirLN14K_form__kexp_tBNt10Hashmap__t2SR9Ast__id_t;

typedef struct _fx_rNt10Hashmap__t2ii_data_t {
   int_ rc;
   struct _fx_Nt10Hashmap__t2ii_data_t* data;
} _fx_rNt10Hashmap__t2ii_data_t, *_fx_rNt10Hashmap__t2ii;

typedef struct {
   int_ rc;
   int_ data;
} _fx_E4Exit_data_t;

typedef struct {
   int_ rc;
   fx_str_t data;
} _fx_E4Fail_data_t;

typedef struct {
   int_ rc;
   struct _fx_T2Ta2iS data;
} _fx_E22LexerUtils__LexerError_data_t;

typedef struct {
   int_ rc;
   struct _fx_T2R10Ast__loc_tS data;
} _fx_E17Ast__CompileError_data_t;

typedef struct {
   int_ rc;
   struct _fx_T2R10Ast__loc_tS data;
} _fx_E18Parser__ParseError_data_t;

static void _fx_free_LS(struct _fx_LS_data_t** dst)
{
   FX_FREE_LIST_IMPL(_fx_LS, fx_free_str);
}

static int _fx_cons_LS(fx_str_t* hd, struct _fx_LS_data_t* tl, bool addref_tl, struct _fx_LS_data_t** fx_result)
{
   FX_MAKE_LIST_IMPL(_fx_LS, fx_copy_str);
}

static void _fx_free_T2Ta2iS(struct _fx_T2Ta2iS* dst)
{
   fx_free_str(&dst->t1);
}

static void _fx_copy_T2Ta2iS(struct _fx_T2Ta2iS* src, struct _fx_T2Ta2iS* dst)
{
   dst->t0 = src->t0;
   fx_copy_str(&src->t1, &dst->t1);
}

static void _fx_make_T2Ta2iS(struct _fx_Ta2i* t0, fx_str_t* t1, struct _fx_T2Ta2iS* fx_result)
{
   fx_result->t0 = *t0;
   fx_copy_str(t1, &fx_result->t1);
}

static int _fx_cons_LN12Ast__scope_t(
   struct _fx_N12Ast__scope_t* hd,
   struct _fx_LN12Ast__scope_t_data_t* tl,
   bool addref_tl,
   struct _fx_LN12Ast__scope_t_data_t** fx_result)
{
   FX_MAKE_LIST_IMPL(_fx_LN12Ast__scope_t, FX_COPY_SIMPLE_BY_PTR);
}

static int _fx_cons_LR9Ast__id_t(
   struct _fx_R9Ast__id_t* hd,
   struct _fx_LR9Ast__id_t_data_t* tl,
   bool addref_tl,
   struct _fx_LR9Ast__id_t_data_t** fx_result)
{
   FX_MAKE_LIST_IMPL(_fx_LR9Ast__id_t, FX_COPY_SIMPLE_BY_PTR);
}

static void _fx_free_R16Ast__val_flags_t(struct _fx_R16Ast__val_flags_t* dst)
{
   fx_free_list_simple(&dst->val_flag_global);
}

static void _fx_copy_R16Ast__val_flags_t(struct _fx_R16Ast__val_flags_t* src, struct _fx_R16Ast__val_flags_t* dst)
{
   dst->val_flag_arg = src->val_flag_arg;
   dst->val_flag_mutable = src->val_flag_mutable;
   dst->val_flag_temp = src->val_flag_temp;
   dst->val_flag_tempref = src->val_flag_tempref;
   dst->val_flag_private = src->val_flag_private;
   dst->val_flag_subarray = src->val_flag_subarray;
   dst->val_flag_instance = src->val_flag_instance;
   dst->val_flag_method = src->val_flag_method;
   dst->val_flag_ctor = src->val_flag_ctor;
   FX_COPY_PTR(src->val_flag_global, &dst->val_flag_global);
}

static void _fx_make_R16Ast__val_flags_t(
   bool r_val_flag_arg,
   bool r_val_flag_mutable,
   bool r_val_flag_temp,
   bool r_val_flag_tempref,
   bool r_val_flag_private,
   bool r_val_flag_subarray,
   bool r_val_flag_instance,
   struct _fx_T2R9Ast__id_ti* r_val_flag_method,
   int_ r_val_flag_ctor,
   struct _fx_LN12Ast__scope_t_data_t* r_val_flag_global,
   struct _fx_R16Ast__val_flags_t* fx_result)
{
   fx_result->val_flag_arg = r_val_flag_arg;
   fx_result->val_flag_mutable = r_val_flag_mutable;
   fx_result->val_flag_temp = r_val_flag_temp;
   fx_result->val_flag_tempref = r_val_flag_tempref;
   fx_result->val_flag_private = r_val_flag_private;
   fx_result->val_flag_subarray = r_val_flag_subarray;
   fx_result->val_flag_instance = r_val_flag_instance;
   fx_result->val_flag_method = *r_val_flag_method;
   fx_result->val_flag_ctor = r_val_flag_ctor;
   FX_COPY_PTR(r_val_flag_global, &fx_result->val_flag_global);
}

static void _fx_free_R17K_form__kdefval_t(struct _fx_R17K_form__kdefval_t* dst)
{
   fx_free_str(&dst->kv_cname);
   _fx_free_N14K_form__ktyp_t(&dst->kv_typ);
   _fx_free_R16Ast__val_flags_t(&dst->kv_flags);
}

static void _fx_copy_R17K_form__kdefval_t(struct _fx_R17K_form__kdefval_t* src, struct _fx_R17K_form__kdefval_t* dst)
{
   dst->kv_name = src->kv_name;
   fx_copy_str(&src->kv_cname, &dst->kv_cname);
   FX_COPY_PTR(src->kv_typ, &dst->kv_typ);
   _fx_copy_R16Ast__val_flags_t(&src->kv_flags, &dst->kv_flags);
   dst->kv_loc = src->kv_loc;
}

static void _fx_make_R17K_form__kdefval_t(
   struct _fx_R9Ast__id_t* r_kv_name,
   fx_str_t* r_kv_cname,
   struct _fx_N14K_form__ktyp_t_data_t* r_kv_typ,
   struct _fx_R16Ast__val_flags_t* r_kv_flags,
   struct _fx_R10Ast__loc_t* r_kv_loc,
   struct _fx_R17K_form__kdefval_t* fx_result)
{
   fx_result->kv_name = *r_kv_name;
   fx_copy_str(r_kv_cname, &fx_result->kv_cname);
   FX_COPY_PTR(r_kv_typ, &fx_result->kv_typ);
   _fx_copy_R16Ast__val_flags_t(r_kv_flags, &fx_result->kv_flags);
   fx_result->kv_loc = *r_kv_loc;
}

static void _fx_free_T2R9Ast__id_tN14K_form__ktyp_t(struct _fx_T2R9Ast__id_tN14K_form__ktyp_t* dst)
{
   _fx_free_N14K_form__ktyp_t(&dst->t1);
}

static void _fx_copy_T2R9Ast__id_tN14K_form__ktyp_t(
   struct _fx_T2R9Ast__id_tN14K_form__ktyp_t* src,
   struct _fx_T2R9Ast__id_tN14K_form__ktyp_t* dst)
{
   dst->t0 = src->t0;
   FX_COPY_PTR(src->t1, &dst->t1);
}

static void _fx_make_T2R9Ast__id_tN14K_form__ktyp_t(
   struct _fx_R9Ast__id_t* t0,
   struct _fx_N14K_form__ktyp_t_data_t* t1,
   struct _fx_T2R9Ast__id_tN14K_form__ktyp_t* fx_result)
{
   fx_result->t0 = *t0;
   FX_COPY_PTR(t1, &fx_result->t1);
}

static void _fx_free_LT2R9Ast__id_tN14K_form__ktyp_t(struct _fx_LT2R9Ast__id_tN14K_form__ktyp_t_data_t** dst)
{
   FX_FREE_LIST_IMPL(_fx_LT2R9Ast__id_tN14K_form__ktyp_t, _fx_free_T2R9Ast__id_tN14K_form__ktyp_t);
}

static int _fx_cons_LT2R9Ast__id_tN14K_form__ktyp_t(
   struct _fx_T2R9Ast__id_tN14K_form__ktyp_t* hd,
   struct _fx_LT2R9Ast__id_tN14K_form__ktyp_t_data_t* tl,
   bool addref_tl,
   struct _fx_LT2R9Ast__id_tN14K_form__ktyp_t_data_t** fx_result)
{
   FX_MAKE_LIST_IMPL(_fx_LT2R9Ast__id_tN14K_form__ktyp_t, _fx_copy_T2R9Ast__id_tN14K_form__ktyp_t);
}

static void _fx_free_R23K_form__kdefinterface_t(struct _fx_R23K_form__kdefinterface_t* dst)
{
   fx_free_str(&dst->ki_cname);
   _fx_free_LT2R9Ast__id_tN14K_form__ktyp_t(&dst->ki_all_methods);
   fx_free_list_simple(&dst->ki_scope);
}

static void _fx_copy_R23K_form__kdefinterface_t(
   struct _fx_R23K_form__kdefinterface_t* src,
   struct _fx_R23K_form__kdefinterface_t* dst)
{
   dst->ki_name = src->ki_name;
   dst->ki_base = src->ki_base;
   fx_copy_str(&src->ki_cname, &dst->ki_cname);
   dst->ki_id = src->ki_id;
   FX_COPY_PTR(src->ki_all_methods, &dst->ki_all_methods);
   FX_COPY_PTR(src->ki_scope, &dst->ki_scope);
   dst->ki_loc = src->ki_loc;
}

static void _fx_make_R23K_form__kdefinterface_t(
   struct _fx_R9Ast__id_t* r_ki_name,
   struct _fx_R9Ast__id_t* r_ki_base,
   fx_str_t* r_ki_cname,
   struct _fx_R9Ast__id_t* r_ki_id,
   struct _fx_LT2R9Ast__id_tN14K_form__ktyp_t_data_t* r_ki_all_methods,
   struct _fx_LN12Ast__scope_t_data_t* r_ki_scope,
   struct _fx_R10Ast__loc_t* r_ki_loc,
   struct _fx_R23K_form__kdefinterface_t* fx_result)
{
   fx_result->ki_name = *r_ki_name;
   fx_result->ki_base = *r_ki_base;
   fx_copy_str(r_ki_cname, &fx_result->ki_cname);
   fx_result->ki_id = *r_ki_id;
   FX_COPY_PTR(r_ki_all_methods, &fx_result->ki_all_methods);
   FX_COPY_PTR(r_ki_scope, &fx_result->ki_scope);
   fx_result->ki_loc = *r_ki_loc;
}

static void _fx_free_rR23K_form__kdefinterface_t(struct _fx_rR23K_form__kdefinterface_t_data_t** dst)
{
   FX_FREE_REF_IMPL(_fx_rR23K_form__kdefinterface_t, _fx_free_R23K_form__kdefinterface_t);
}

static int _fx_make_rR23K_form__kdefinterface_t(
   struct _fx_R23K_form__kdefinterface_t* arg,
   struct _fx_rR23K_form__kdefinterface_t_data_t** fx_result)
{
   FX_MAKE_REF_IMPL(_fx_rR23K_form__kdefinterface_t, _fx_copy_R23K_form__kdefinterface_t);
}

static void _fx_free_R17K_form__kdeffun_t(struct _fx_R17K_form__kdeffun_t* dst)
{
   fx_free_str(&dst->kf_cname);
   fx_free_list_simple(&dst->kf_params);
   _fx_free_N14K_form__ktyp_t(&dst->kf_rt);
   _fx_free_N14K_form__kexp_t(&dst->kf_body);
   fx_free_list_simple(&dst->kf_scope);
}

static void _fx_copy_R17K_form__kdeffun_t(struct _fx_R17K_form__kdeffun_t* src, struct _fx_R17K_form__kdeffun_t* dst)
{
   dst->kf_name = src->kf_name;
   fx_copy_str(&src->kf_cname, &dst->kf_cname);
   FX_COPY_PTR(src->kf_params, &dst->kf_params);
   FX_COPY_PTR(src->kf_rt, &dst->kf_rt);
   FX_COPY_PTR(src->kf_body, &dst->kf_body);
   dst->kf_flags = src->kf_flags;
   dst->kf_closure = src->kf_closure;
   FX_COPY_PTR(src->kf_scope, &dst->kf_scope);
   dst->kf_loc = src->kf_loc;
}

static void _fx_make_R17K_form__kdeffun_t(
   struct _fx_R9Ast__id_t* r_kf_name,
   fx_str_t* r_kf_cname,
   struct _fx_LR9Ast__id_t_data_t* r_kf_params,
   struct _fx_N14K_form__ktyp_t_data_t* r_kf_rt,
   struct _fx_N14K_form__kexp_t_data_t* r_kf_body,
   struct _fx_R16Ast__fun_flags_t* r_kf_flags,
   struct _fx_R25K_form__kdefclosureinfo_t* r_kf_closure,
   struct _fx_LN12Ast__scope_t_data_t* r_kf_scope,
   struct _fx_R10Ast__loc_t* r_kf_loc,
   struct _fx_R17K_form__kdeffun_t* fx_result)
{
   fx_result->kf_name = *r_kf_name;
   fx_copy_str(r_kf_cname, &fx_result->kf_cname);
   FX_COPY_PTR(r_kf_params, &fx_result->kf_params);
   FX_COPY_PTR(r_kf_rt, &fx_result->kf_rt);
   FX_COPY_PTR(r_kf_body, &fx_result->kf_body);
   fx_result->kf_flags = *r_kf_flags;
   fx_result->kf_closure = *r_kf_closure;
   FX_COPY_PTR(r_kf_scope, &fx_result->kf_scope);
   fx_result->kf_loc = *r_kf_loc;
}

static void _fx_free_rR17K_form__kdeffun_t(struct _fx_rR17K_form__kdeffun_t_data_t** dst)
{
   FX_FREE_REF_IMPL(_fx_rR17K_form__kdeffun_t, _fx_free_R17K_form__kdeffun_t);
}

static int _fx_make_rR17K_form__kdeffun_t(
   struct _fx_R17K_form__kdeffun_t* arg,
   struct _fx_rR17K_form__kdeffun_t_data_t** fx_result)
{
   FX_MAKE_REF_IMPL(_fx_rR17K_form__kdeffun_t, _fx_copy_R17K_form__kdeffun_t);
}

static void _fx_free_R17K_form__kdefexn_t(struct _fx_R17K_form__kdefexn_t* dst)
{
   fx_free_str(&dst->ke_cname);
   fx_free_str(&dst->ke_base_cname);
   _fx_free_N14K_form__ktyp_t(&dst->ke_typ);
   fx_free_list_simple(&dst->ke_scope);
}

static void _fx_copy_R17K_form__kdefexn_t(struct _fx_R17K_form__kdefexn_t* src, struct _fx_R17K_form__kdefexn_t* dst)
{
   dst->ke_name = src->ke_name;
   fx_copy_str(&src->ke_cname, &dst->ke_cname);
   fx_copy_str(&src->ke_base_cname, &dst->ke_base_cname);
   FX_COPY_PTR(src->ke_typ, &dst->ke_typ);
   dst->ke_std = src->ke_std;
   dst->ke_tag = src->ke_tag;
   dst->ke_make = src->ke_make;
   FX_COPY_PTR(src->ke_scope, &dst->ke_scope);
   dst->ke_loc = src->ke_loc;
}

static void _fx_make_R17K_form__kdefexn_t(
   struct _fx_R9Ast__id_t* r_ke_name,
   fx_str_t* r_ke_cname,
   fx_str_t* r_ke_base_cname,
   struct _fx_N14K_form__ktyp_t_data_t* r_ke_typ,
   bool r_ke_std,
   struct _fx_R9Ast__id_t* r_ke_tag,
   struct _fx_R9Ast__id_t* r_ke_make,
   struct _fx_LN12Ast__scope_t_data_t* r_ke_scope,
   struct _fx_R10Ast__loc_t* r_ke_loc,
   struct _fx_R17K_form__kdefexn_t* fx_result)
{
   fx_result->ke_name = *r_ke_name;
   fx_copy_str(r_ke_cname, &fx_result->ke_cname);
   fx_copy_str(r_ke_base_cname, &fx_result->ke_base_cname);
   FX_COPY_PTR(r_ke_typ, &fx_result->ke_typ);
   fx_result->ke_std = r_ke_std;
   fx_result->ke_tag = *r_ke_tag;
   fx_result->ke_make = *r_ke_make;
   FX_COPY_PTR(r_ke_scope, &fx_result->ke_scope);
   fx_result->ke_loc = *r_ke_loc;
}

static void _fx_free_rR17K_form__kdefexn_t(struct _fx_rR17K_form__kdefexn_t_data_t** dst)
{
   FX_FREE_REF_IMPL(_fx_rR17K_form__kdefexn_t, _fx_free_R17K_form__kdefexn_t);
}

static int _fx_make_rR17K_form__kdefexn_t(
   struct _fx_R17K_form__kdefexn_t* arg,
   struct _fx_rR17K_form__kdefexn_t_data_t** fx_result)
{
   FX_MAKE_REF_IMPL(_fx_rR17K_form__kdefexn_t, _fx_copy_R17K_form__kdefexn_t);
}

static void _fx_free_LN14K_form__ktyp_t(struct _fx_LN14K_form__ktyp_t_data_t** dst)
{
   FX_FREE_LIST_IMPL(_fx_LN14K_form__ktyp_t, _fx_free_N14K_form__ktyp_t);
}

static int _fx_cons_LN14K_form__ktyp_t(
   struct _fx_N14K_form__ktyp_t_data_t* hd,
   struct _fx_LN14K_form__ktyp_t_data_t* tl,
   bool addref_tl,
   struct _fx_LN14K_form__ktyp_t_data_t** fx_result)
{
   FX_MAKE_LIST_IMPL(_fx_LN14K_form__ktyp_t, FX_COPY_PTR);
}

static void _fx_free_T2R9Ast__id_tLR9Ast__id_t(struct _fx_T2R9Ast__id_tLR9Ast__id_t* dst)
{
   fx_free_list_simple(&dst->t1);
}

static void _fx_copy_T2R9Ast__id_tLR9Ast__id_t(
   struct _fx_T2R9Ast__id_tLR9Ast__id_t* src,
   struct _fx_T2R9Ast__id_tLR9Ast__id_t* dst)
{
   dst->t0 = src->t0;
   FX_COPY_PTR(src->t1, &dst->t1);
}

static void _fx_make_T2R9Ast__id_tLR9Ast__id_t(
   struct _fx_R9Ast__id_t* t0,
   struct _fx_LR9Ast__id_t_data_t* t1,
   struct _fx_T2R9Ast__id_tLR9Ast__id_t* fx_result)
{
   fx_result->t0 = *t0;
   FX_COPY_PTR(t1, &fx_result->t1);
}

static void _fx_free_LT2R9Ast__id_tLR9Ast__id_t(struct _fx_LT2R9Ast__id_tLR9Ast__id_t_data_t** dst)
{
   FX_FREE_LIST_IMPL(_fx_LT2R9Ast__id_tLR9Ast__id_t, _fx_free_T2R9Ast__id_tLR9Ast__id_t);
}

static int _fx_cons_LT2R9Ast__id_tLR9Ast__id_t(
   struct _fx_T2R9Ast__id_tLR9Ast__id_t* hd,
   struct _fx_LT2R9Ast__id_tLR9Ast__id_t_data_t* tl,
   bool addref_tl,
   struct _fx_LT2R9Ast__id_tLR9Ast__id_t_data_t** fx_result)
{
   FX_MAKE_LIST_IMPL(_fx_LT2R9Ast__id_tLR9Ast__id_t, _fx_copy_T2R9Ast__id_tLR9Ast__id_t);
}

static void _fx_free_R21K_form__kdefvariant_t(struct _fx_R21K_form__kdefvariant_t* dst)
{
   fx_free_str(&dst->kvar_cname);
   _fx_free_LN14K_form__ktyp_t(&dst->kvar_targs);
   _fx_free_LT2R9Ast__id_tN14K_form__ktyp_t(&dst->kvar_cases);
   fx_free_list_simple(&dst->kvar_ctors);
   _fx_free_LT2R9Ast__id_tLR9Ast__id_t(&dst->kvar_ifaces);
   fx_free_list_simple(&dst->kvar_scope);
}

static void _fx_copy_R21K_form__kdefvariant_t(
   struct _fx_R21K_form__kdefvariant_t* src,
   struct _fx_R21K_form__kdefvariant_t* dst)
{
   dst->kvar_name = src->kvar_name;
   fx_copy_str(&src->kvar_cname, &dst->kvar_cname);
   dst->kvar_proto = src->kvar_proto;
   dst->kvar_props = src->kvar_props;
   FX_COPY_PTR(src->kvar_targs, &dst->kvar_targs);
   FX_COPY_PTR(src->kvar_cases, &dst->kvar_cases);
   FX_COPY_PTR(src->kvar_ctors, &dst->kvar_ctors);
   dst->kvar_flags = src->kvar_flags;
   FX_COPY_PTR(src->kvar_ifaces, &dst->kvar_ifaces);
   FX_COPY_PTR(src->kvar_scope, &dst->kvar_scope);
   dst->kvar_loc = src->kvar_loc;
}

static void _fx_make_R21K_form__kdefvariant_t(
   struct _fx_R9Ast__id_t* r_kvar_name,
   fx_str_t* r_kvar_cname,
   struct _fx_R9Ast__id_t* r_kvar_proto,
   struct _fx_Nt6option1R17K_form__ktprops_t* r_kvar_props,
   struct _fx_LN14K_form__ktyp_t_data_t* r_kvar_targs,
   struct _fx_LT2R9Ast__id_tN14K_form__ktyp_t_data_t* r_kvar_cases,
   struct _fx_LR9Ast__id_t_data_t* r_kvar_ctors,
   struct _fx_R16Ast__var_flags_t* r_kvar_flags,
   struct _fx_LT2R9Ast__id_tLR9Ast__id_t_data_t* r_kvar_ifaces,
   struct _fx_LN12Ast__scope_t_data_t* r_kvar_scope,
   struct _fx_R10Ast__loc_t* r_kvar_loc,
   struct _fx_R21K_form__kdefvariant_t* fx_result)
{
   fx_result->kvar_name = *r_kvar_name;
   fx_copy_str(r_kvar_cname, &fx_result->kvar_cname);
   fx_result->kvar_proto = *r_kvar_proto;
   fx_result->kvar_props = *r_kvar_props;
   FX_COPY_PTR(r_kvar_targs, &fx_result->kvar_targs);
   FX_COPY_PTR(r_kvar_cases, &fx_result->kvar_cases);
   FX_COPY_PTR(r_kvar_ctors, &fx_result->kvar_ctors);
   fx_result->kvar_flags = *r_kvar_flags;
   FX_COPY_PTR(r_kvar_ifaces, &fx_result->kvar_ifaces);
   FX_COPY_PTR(r_kvar_scope, &fx_result->kvar_scope);
   fx_result->kvar_loc = *r_kvar_loc;
}

static void _fx_free_rR21K_form__kdefvariant_t(struct _fx_rR21K_form__kdefvariant_t_data_t** dst)
{
   FX_FREE_REF_IMPL(_fx_rR21K_form__kdefvariant_t, _fx_free_R21K_form__kdefvariant_t);
}

static int _fx_make_rR21K_form__kdefvariant_t(
   struct _fx_R21K_form__kdefvariant_t* arg,
   struct _fx_rR21K_form__kdefvariant_t_data_t** fx_result)
{
   FX_MAKE_REF_IMPL(_fx_rR21K_form__kdefvariant_t, _fx_copy_R21K_form__kdefvariant_t);
}

static void _fx_free_R17K_form__kdeftyp_t(struct _fx_R17K_form__kdeftyp_t* dst)
{
   fx_free_str(&dst->kt_cname);
   _fx_free_LN14K_form__ktyp_t(&dst->kt_targs);
   _fx_free_N14K_form__ktyp_t(&dst->kt_typ);
   fx_free_list_simple(&dst->kt_scope);
}

static void _fx_copy_R17K_form__kdeftyp_t(struct _fx_R17K_form__kdeftyp_t* src, struct _fx_R17K_form__kdeftyp_t* dst)
{
   dst->kt_name = src->kt_name;
   fx_copy_str(&src->kt_cname, &dst->kt_cname);
   dst->kt_proto = src->kt_proto;
   dst->kt_props = src->kt_props;
   FX_COPY_PTR(src->kt_targs, &dst->kt_targs);
   FX_COPY_PTR(src->kt_typ, &dst->kt_typ);
   FX_COPY_PTR(src->kt_scope, &dst->kt_scope);
   dst->kt_loc = src->kt_loc;
}

static void _fx_make_R17K_form__kdeftyp_t(
   struct _fx_R9Ast__id_t* r_kt_name,
   fx_str_t* r_kt_cname,
   struct _fx_R9Ast__id_t* r_kt_proto,
   struct _fx_Nt6option1R17K_form__ktprops_t* r_kt_props,
   struct _fx_LN14K_form__ktyp_t_data_t* r_kt_targs,
   struct _fx_N14K_form__ktyp_t_data_t* r_kt_typ,
   struct _fx_LN12Ast__scope_t_data_t* r_kt_scope,
   struct _fx_R10Ast__loc_t* r_kt_loc,
   struct _fx_R17K_form__kdeftyp_t* fx_result)
{
   fx_result->kt_name = *r_kt_name;
   fx_copy_str(r_kt_cname, &fx_result->kt_cname);
   fx_result->kt_proto = *r_kt_proto;
   fx_result->kt_props = *r_kt_props;
   FX_COPY_PTR(r_kt_targs, &fx_result->kt_targs);
   FX_COPY_PTR(r_kt_typ, &fx_result->kt_typ);
   FX_COPY_PTR(r_kt_scope, &fx_result->kt_scope);
   fx_result->kt_loc = *r_kt_loc;
}

static void _fx_free_rR17K_form__kdeftyp_t(struct _fx_rR17K_form__kdeftyp_t_data_t** dst)
{
   FX_FREE_REF_IMPL(_fx_rR17K_form__kdeftyp_t, _fx_free_R17K_form__kdeftyp_t);
}

static int _fx_make_rR17K_form__kdeftyp_t(
   struct _fx_R17K_form__kdeftyp_t* arg,
   struct _fx_rR17K_form__kdeftyp_t_data_t** fx_result)
{
   FX_MAKE_REF_IMPL(_fx_rR17K_form__kdeftyp_t, _fx_copy_R17K_form__kdeftyp_t);
}

static void _fx_free_R25K_form__kdefclosurevars_t(struct _fx_R25K_form__kdefclosurevars_t* dst)
{
   fx_free_str(&dst->kcv_cname);
   _fx_free_LT2R9Ast__id_tN14K_form__ktyp_t(&dst->kcv_freevars);
   fx_free_list_simple(&dst->kcv_orig_freevars);
   fx_free_list_simple(&dst->kcv_scope);
}

static void _fx_copy_R25K_form__kdefclosurevars_t(
   struct _fx_R25K_form__kdefclosurevars_t* src,
   struct _fx_R25K_form__kdefclosurevars_t* dst)
{
   dst->kcv_name = src->kcv_name;
   fx_copy_str(&src->kcv_cname, &dst->kcv_cname);
   FX_COPY_PTR(src->kcv_freevars, &dst->kcv_freevars);
   FX_COPY_PTR(src->kcv_orig_freevars, &dst->kcv_orig_freevars);
   FX_COPY_PTR(src->kcv_scope, &dst->kcv_scope);
   dst->kcv_loc = src->kcv_loc;
}

static void _fx_make_R25K_form__kdefclosurevars_t(
   struct _fx_R9Ast__id_t* r_kcv_name,
   fx_str_t* r_kcv_cname,
   struct _fx_LT2R9Ast__id_tN14K_form__ktyp_t_data_t* r_kcv_freevars,
   struct _fx_LR9Ast__id_t_data_t* r_kcv_orig_freevars,
   struct _fx_LN12Ast__scope_t_data_t* r_kcv_scope,
   struct _fx_R10Ast__loc_t* r_kcv_loc,
   struct _fx_R25K_form__kdefclosurevars_t* fx_result)
{
   fx_result->kcv_name = *r_kcv_name;
   fx_copy_str(r_kcv_cname, &fx_result->kcv_cname);
   FX_COPY_PTR(r_kcv_freevars, &fx_result->kcv_freevars);
   FX_COPY_PTR(r_kcv_orig_freevars, &fx_result->kcv_orig_freevars);
   FX_COPY_PTR(r_kcv_scope, &fx_result->kcv_scope);
   fx_result->kcv_loc = *r_kcv_loc;
}

static void _fx_free_rR25K_form__kdefclosurevars_t(struct _fx_rR25K_form__kdefclosurevars_t_data_t** dst)
{
   FX_FREE_REF_IMPL(_fx_rR25K_form__kdefclosurevars_t, _fx_free_R25K_form__kdefclosurevars_t);
}

static int _fx_make_rR25K_form__kdefclosurevars_t(
   struct _fx_R25K_form__kdefclosurevars_t* arg,
   struct _fx_rR25K_form__kdefclosurevars_t_data_t** fx_result)
{
   FX_MAKE_REF_IMPL(_fx_rR25K_form__kdefclosurevars_t, _fx_copy_R25K_form__kdefclosurevars_t);
}

static void _fx_free_N15K_form__kinfo_t(struct _fx_N15K_form__kinfo_t* dst)
{
   switch (dst->tag) {
   case 2:
      _fx_free_R17K_form__kdefval_t(&dst->u.KVal); break;
   case 3:
      _fx_free_rR17K_form__kdeffun_t(&dst->u.KFun); break;
   case 4:
      _fx_free_rR17K_form__kdefexn_t(&dst->u.KExn); break;
   case 5:
      _fx_free_rR21K_form__kdefvariant_t(&dst->u.KVariant); break;
   case 6:
      _fx_free_rR25K_form__kdefclosurevars_t(&dst->u.KClosureVars); break;
   case 7:
      _fx_free_rR23K_form__kdefinterface_t(&dst->u.KInterface); break;
   case 8:
      _fx_free_rR17K_form__kdeftyp_t(&dst->u.KTyp); break;
   default:
      ;
   }
   dst->tag = 0;
}

static void _fx_copy_N15K_form__kinfo_t(struct _fx_N15K_form__kinfo_t* src, struct _fx_N15K_form__kinfo_t* dst)
{
   dst->tag = src->tag;
   switch (src->tag) {
   case 2:
      _fx_copy_R17K_form__kdefval_t(&src->u.KVal, &dst->u.KVal); break;
   case 3:
      FX_COPY_PTR(src->u.KFun, &dst->u.KFun); break;
   case 4:
      FX_COPY_PTR(src->u.KExn, &dst->u.KExn); break;
   case 5:
      FX_COPY_PTR(src->u.KVariant, &dst->u.KVariant); break;
   case 6:
      FX_COPY_PTR(src->u.KClosureVars, &dst->u.KClosureVars); break;
   case 7:
      FX_COPY_PTR(src->u.KInterface, &dst->u.KInterface); break;
   case 8:
      FX_COPY_PTR(src->u.KTyp, &dst->u.KTyp); break;
   default:
      dst->u = src->u;
   }
}

static void _fx_free_T3iA1SS(struct _fx_T3iA1SS* dst)
{
   fx_free_arr(&dst->t1);
   fx_free_str(&dst->t2);
}

static void _fx_copy_T3iA1SS(struct _fx_T3iA1SS* src, struct _fx_T3iA1SS* dst)
{
   dst->t0 = src->t0;
   fx_copy_arr(&src->t1, &dst->t1);
   fx_copy_str(&src->t2, &dst->t2);
}

static void _fx_make_T3iA1SS(int_ t0, fx_arr_t* t1, fx_str_t* t2, struct _fx_T3iA1SS* fx_result)
{
   fx_result->t0 = t0;
   fx_copy_arr(t1, &fx_result->t1);
   fx_copy_str(t2, &fx_result->t2);
}

static void _fx_free_Nt9Dynvec__t1S(struct _fx_Nt9Dynvec__t1S_data_t** dst)
{
   if (*dst && FX_DECREF((*dst)->rc) == 1) {
      _fx_free_T3iA1SS(&(*dst)->u.t); fx_free(*dst);
   }
   *dst = 0;
}

static void _fx_free_T2R10Ast__loc_tS(struct _fx_T2R10Ast__loc_tS* dst)
{
   fx_free_str(&dst->t1);
}

static void _fx_copy_T2R10Ast__loc_tS(struct _fx_T2R10Ast__loc_tS* src, struct _fx_T2R10Ast__loc_tS* dst)
{
   dst->t0 = src->t0;
   fx_copy_str(&src->t1, &dst->t1);
}

static void _fx_make_T2R10Ast__loc_tS(struct _fx_R10Ast__loc_t* t0, fx_str_t* t1, struct _fx_T2R10Ast__loc_tS* fx_result)
{
   fx_result->t0 = *t0;
   fx_copy_str(t1, &fx_result->t1);
}

static void _fx_free_N13Ast__binary_t(struct _fx_N13Ast__binary_t_data_t** dst)
{
   if (*dst && FX_DECREF((*dst)->rc) == 1) {
      switch ((*dst)->tag) {
      case 27:
         _fx_free_N13Ast__binary_t(&(*dst)->u.OpAugBinary); break;
      default:
         ;
      }
      fx_free(*dst);
   }
   *dst = 0;
}

static void _fx_free_T2SR10Ast__loc_t(struct _fx_T2SR10Ast__loc_t* dst)
{
   fx_free_str(&dst->t0);
}

static void _fx_copy_T2SR10Ast__loc_t(struct _fx_T2SR10Ast__loc_t* src, struct _fx_T2SR10Ast__loc_t* dst)
{
   fx_copy_str(&src->t0, &dst->t0);
   dst->t1 = src->t1;
}

static void _fx_make_T2SR10Ast__loc_t(fx_str_t* t0, struct _fx_R10Ast__loc_t* t1, struct _fx_T2SR10Ast__loc_t* fx_result)
{
   fx_copy_str(t0, &fx_result->t0);
   fx_result->t1 = *t1;
}

static void _fx_free_LT2SR10Ast__loc_t(struct _fx_LT2SR10Ast__loc_t_data_t** dst)
{
   FX_FREE_LIST_IMPL(_fx_LT2SR10Ast__loc_t, _fx_free_T2SR10Ast__loc_t);
}

static int _fx_cons_LT2SR10Ast__loc_t(
   struct _fx_T2SR10Ast__loc_t* hd,
   struct _fx_LT2SR10Ast__loc_t_data_t* tl,
   bool addref_tl,
   struct _fx_LT2SR10Ast__loc_t_data_t** fx_result)
{
   FX_MAKE_LIST_IMPL(_fx_LT2SR10Ast__loc_t, _fx_copy_T2SR10Ast__loc_t);
}

static int _fx_cons_Li(int_ hd, struct _fx_Li_data_t* tl, bool addref_tl, struct _fx_Li_data_t** fx_result)
{
   FX_MAKE_LIST_IMPL(_fx_Li, FX_COPY_SIMPLE);
}

static int _fx_make_ri(int_ arg, struct _fx_ri_data_t** fx_result)
{
   FX_MAKE_REF_IMPL(_fx_ri, FX_COPY_SIMPLE);
}

static void _fx_free_N14K_form__klit_t(struct _fx_N14K_form__klit_t* dst)
{
   switch (dst->tag) {
   case 5:
      fx_free_str(&dst->u.KLitString); break;
   case 8:
      _fx_free_N14K_form__ktyp_t(&dst->u.KLitNil); break;
   default:
      ;
   }
   dst->tag = 0;
}

static void _fx_copy_N14K_form__klit_t(struct _fx_N14K_form__klit_t* src, struct _fx_N14K_form__klit_t* dst)
{
   dst->tag = src->tag;
   switch (src->tag) {
   case 5:
      fx_copy_str(&src->u.KLitString, &dst->u.KLitString); break;
   case 8:
      FX_COPY_PTR(src->u.KLitNil, &dst->u.KLitNil); break;
   default:
      dst->u = src->u;
   }
}

static void _fx_free_N14K_form__atom_t(struct _fx_N14K_form__atom_t* dst)
{
   switch (dst->tag) {
   case 2:
      _fx_free_N14K_form__klit_t(&dst->u.AtomLit); break;
   default:
      ;
   }
   dst->tag = 0;
}

static void _fx_copy_N14K_form__atom_t(struct _fx_N14K_form__atom_t* src, struct _fx_N14K_form__atom_t* dst)
{
   dst->tag = src->tag;
   switch (src->tag) {
   case 2:
      _fx_copy_N14K_form__klit_t(&src->u.AtomLit, &dst->u.AtomLit); break;
   default:
      dst->u = src->u;
   }
}

static void _fx_free_R22K_form__k_fold_callb_t(struct _fx_R22K_form__k_fold_callb_t* dst)
{
   _fx_free_Nt6option1FPv3N14K_form__ktyp_tR10Ast__loc_tR22K_form__k_fold_callb_t(&dst->kcb_fold_ktyp);
   _fx_free_Nt6option1FPv2N14K_form__kexp_tR22K_form__k_fold_callb_t(&dst->kcb_fold_kexp);
   _fx_free_Nt6option1FPv3N14K_form__atom_tR10Ast__loc_tR22K_form__k_fold_callb_t(&dst->kcb_fold_atom);
}

static void _fx_copy_R22K_form__k_fold_callb_t(
   struct _fx_R22K_form__k_fold_callb_t* src,
   struct _fx_R22K_form__k_fold_callb_t* dst)
{
   FX_COPY_PTR(src->kcb_fold_ktyp, &dst->kcb_fold_ktyp);
   FX_COPY_PTR(src->kcb_fold_kexp, &dst->kcb_fold_kexp);
   FX_COPY_PTR(src->kcb_fold_atom, &dst->kcb_fold_atom);
}

static void _fx_make_R22K_form__k_fold_callb_t(
   struct _fx_Nt6option1FPv3N14K_form__ktyp_tR10Ast__loc_tR22K_form__k_fold_callb_t_data_t* r_kcb_fold_ktyp,
   struct _fx_Nt6option1FPv2N14K_form__kexp_tR22K_form__k_fold_callb_t_data_t* r_kcb_fold_kexp,
   struct _fx_Nt6option1FPv3N14K_form__atom_tR10Ast__loc_tR22K_form__k_fold_callb_t_data_t* r_kcb_fold_atom,
   struct _fx_R22K_form__k_fold_callb_t* fx_result)
{
   FX_COPY_PTR(r_kcb_fold_ktyp, &fx_result->kcb_fold_ktyp);
   FX_COPY_PTR(r_kcb_fold_kexp, &fx_result->kcb_fold_kexp);
   FX_COPY_PTR(r_kcb_fold_atom, &fx_result->kcb_fold_atom);
}

static void _fx_free_Nt6option1FPv3N14K_form__atom_tR10Ast__loc_tR22K_form__k_fold_callb_t(
   struct _fx_Nt6option1FPv3N14K_form__atom_tR10Ast__loc_tR22K_form__k_fold_callb_t_data_t** dst)
{
   if (*dst && FX_DECREF((*dst)->rc) == 1) {
      fx_free_fp(&(*dst)->u.Some); fx_free(*dst);
   }
   *dst = 0;
}

static void _fx_free_Nt6option1FPv2N14K_form__kexp_tR22K_form__k_fold_callb_t(
   struct _fx_Nt6option1FPv2N14K_form__kexp_tR22K_form__k_fold_callb_t_data_t** dst)
{
   if (*dst && FX_DECREF((*dst)->rc) == 1) {
      fx_free_fp(&(*dst)->u.Some); fx_free(*dst);
   }
   *dst = 0;
}

static void _fx_free_Nt6option1FPv3N14K_form__ktyp_tR10Ast__loc_tR22K_form__k_fold_callb_t(
   struct _fx_Nt6option1FPv3N14K_form__ktyp_tR10Ast__loc_tR22K_form__k_fold_callb_t_data_t** dst)
{
   if (*dst && FX_DECREF((*dst)->rc) == 1) {
      fx_free_fp(&(*dst)->u.Some); fx_free(*dst);
   }
   *dst = 0;
}

static void _fx_free_R17K_form__k_callb_t(struct _fx_R17K_form__k_callb_t* dst)
{
   _fx_free_Nt6option1FPN14K_form__ktyp_t3N14K_form__ktyp_tR10Ast__loc_tR17K_form__k_callb_t(&dst->kcb_ktyp);
   _fx_free_Nt6option1FPN14K_form__kexp_t2N14K_form__kexp_tR17K_form__k_callb_t(&dst->kcb_kexp);
   _fx_free_Nt6option1FPN14K_form__atom_t3N14K_form__atom_tR10Ast__loc_tR17K_form__k_callb_t(&dst->kcb_atom);
}

static void _fx_copy_R17K_form__k_callb_t(struct _fx_R17K_form__k_callb_t* src, struct _fx_R17K_form__k_callb_t* dst)
{
   FX_COPY_PTR(src->kcb_ktyp, &dst->kcb_ktyp);
   FX_COPY_PTR(src->kcb_kexp, &dst->kcb_kexp);
   FX_COPY_PTR(src->kcb_atom, &dst->kcb_atom);
}

static void _fx_make_R17K_form__k_callb_t(
   struct _fx_Nt6option1FPN14K_form__ktyp_t3N14K_form__ktyp_tR10Ast__loc_tR17K_form__k_callb_t_data_t* r_kcb_ktyp,
   struct _fx_Nt6option1FPN14K_form__kexp_t2N14K_form__kexp_tR17K_form__k_callb_t_data_t* r_kcb_kexp,
   struct _fx_Nt6option1FPN14K_form__atom_t3N14K_form__atom_tR10Ast__loc_tR17K_form__k_callb_t_data_t* r_kcb_atom,
   struct _fx_R17K_form__k_callb_t* fx_result)
{
   FX_COPY_PTR(r_kcb_ktyp, &fx_result->kcb_ktyp);
   FX_COPY_PTR(r_kcb_kexp, &fx_result->kcb_kexp);
   FX_COPY_PTR(r_kcb_atom, &fx_result->kcb_atom);
}

static void _fx_free_Nt6option1FPN14K_form__atom_t3N14K_form__atom_tR10Ast__loc_tR17K_form__k_callb_t(
   struct _fx_Nt6option1FPN14K_form__atom_t3N14K_form__atom_tR10Ast__loc_tR17K_form__k_callb_t_data_t** dst)
{
   if (*dst && FX_DECREF((*dst)->rc) == 1) {
      fx_free_fp(&(*dst)->u.Some); fx_free(*dst);
   }
   *dst = 0;
}

static void _fx_free_Nt6option1FPN14K_form__kexp_t2N14K_form__kexp_tR17K_form__k_callb_t(
   struct _fx_Nt6option1FPN14K_form__kexp_t2N14K_form__kexp_tR17K_form__k_callb_t_data_t** dst)
{
   if (*dst && FX_DECREF((*dst)->rc) == 1) {
      fx_free_fp(&(*dst)->u.Some); fx_free(*dst);
   }
   *dst = 0;
}

static void _fx_free_Nt6option1FPN14K_form__ktyp_t3N14K_form__ktyp_tR10Ast__loc_tR17K_form__k_callb_t(
   struct _fx_Nt6option1FPN14K_form__ktyp_t3N14K_form__ktyp_tR10Ast__loc_tR17K_form__k_callb_t_data_t** dst)
{
   if (*dst && FX_DECREF((*dst)->rc) == 1) {
      fx_free_fp(&(*dst)->u.Some); fx_free(*dst);
   }
   *dst = 0;
}

static void _fx_free_Nt6option1N14K_form__atom_t(struct _fx_Nt6option1N14K_form__atom_t* dst)
{
   switch (dst->tag) {
   case 2:
      _fx_free_N14K_form__atom_t(&dst->u.Some); break;
   default:
      ;
   }
   dst->tag = 0;
}

static void _fx_copy_Nt6option1N14K_form__atom_t(
   struct _fx_Nt6option1N14K_form__atom_t* src,
   struct _fx_Nt6option1N14K_form__atom_t* dst)
{
   dst->tag = src->tag;
   switch (src->tag) {
   case 2:
      _fx_copy_N14K_form__atom_t(&src->u.Some, &dst->u.Some); break;
   default:
      dst->u = src->u;
   }
}

static void _fx_free_LN14K_form__kexp_t(struct _fx_LN14K_form__kexp_t_data_t** dst)
{
   FX_FREE_LIST_IMPL(_fx_LN14K_form__kexp_t, _fx_free_N14K_form__kexp_t);
}

static int _fx_cons_LN14K_form__kexp_t(
   struct _fx_N14K_form__kexp_t_data_t* hd,
   struct _fx_LN14K_form__kexp_t_data_t* tl,
   bool addref_tl,
   struct _fx_LN14K_form__kexp_t_data_t** fx_result)
{
   FX_MAKE_LIST_IMPL(_fx_LN14K_form__kexp_t, FX_COPY_PTR);
}

static void _fx_free_T2BN14K_form__atom_t(struct _fx_T2BN14K_form__atom_t* dst)
{
   _fx_free_N14K_form__atom_t(&dst->t1);
}

static void _fx_copy_T2BN14K_form__atom_t(struct _fx_T2BN14K_form__atom_t* src, struct _fx_T2BN14K_form__atom_t* dst)
{
   dst->t0 = src->t0;
   _fx_copy_N14K_form__atom_t(&src->t1, &dst->t1);
}

static void _fx_make_T2BN14K_form__atom_t(bool t0, struct _fx_N14K_form__atom_t* t1, struct _fx_T2BN14K_form__atom_t* fx_result)
{
   fx_result->t0 = t0;
   _fx_copy_N14K_form__atom_t(t1, &fx_result->t1);
}

static void _fx_free_LT2BN14K_form__atom_t(struct _fx_LT2BN14K_form__atom_t_data_t** dst)
{
   FX_FREE_LIST_IMPL(_fx_LT2BN14K_form__atom_t, _fx_free_T2BN14K_form__atom_t);
}

static int _fx_cons_LT2BN14K_form__atom_t(
   struct _fx_T2BN14K_form__atom_t* hd,
   struct _fx_LT2BN14K_form__atom_t_data_t* tl,
   bool addref_tl,
   struct _fx_LT2BN14K_form__atom_t_data_t** fx_result)
{
   FX_MAKE_LIST_IMPL(_fx_LT2BN14K_form__atom_t, _fx_copy_T2BN14K_form__atom_t);
}

static void _fx_free_T2LN14K_form__ktyp_tN14K_form__ktyp_t(struct _fx_T2LN14K_form__ktyp_tN14K_form__ktyp_t* dst)
{
   _fx_free_LN14K_form__ktyp_t(&dst->t0);
   _fx_free_N14K_form__ktyp_t(&dst->t1);
}

static void _fx_copy_T2LN14K_form__ktyp_tN14K_form__ktyp_t(
   struct _fx_T2LN14K_form__ktyp_tN14K_form__ktyp_t* src,
   struct _fx_T2LN14K_form__ktyp_tN14K_form__ktyp_t* dst)
{
   FX_COPY_PTR(src->t0, &dst->t0);
   FX_COPY_PTR(src->t1, &dst->t1);
}

static void _fx_make_T2LN14K_form__ktyp_tN14K_form__ktyp_t(
   struct _fx_LN14K_form__ktyp_t_data_t* t0,
   struct _fx_N14K_form__ktyp_t_data_t* t1,
   struct _fx_T2LN14K_form__ktyp_tN14K_form__ktyp_t* fx_result)
{
   FX_COPY_PTR(t0, &fx_result->t0);
   FX_COPY_PTR(t1, &fx_result->t1);
}

static void _fx_free_T2R9Ast__id_tLT2R9Ast__id_tN14K_form__ktyp_t(struct _fx_T2R9Ast__id_tLT2R9Ast__id_tN14K_form__ktyp_t* dst)
{
   _fx_free_LT2R9Ast__id_tN14K_form__ktyp_t(&dst->t1);
}

static void _fx_copy_T2R9Ast__id_tLT2R9Ast__id_tN14K_form__ktyp_t(
   struct _fx_T2R9Ast__id_tLT2R9Ast__id_tN14K_form__ktyp_t* src,
   struct _fx_T2R9Ast__id_tLT2R9Ast__id_tN14K_form__ktyp_t* dst)
{
   dst->t0 = src->t0;
   FX_COPY_PTR(src->t1, &dst->t1);
}

static void _fx_make_T2R9Ast__id_tLT2R9Ast__id_tN14K_form__ktyp_t(
   struct _fx_R9Ast__id_t* t0,
   struct _fx_LT2R9Ast__id_tN14K_form__ktyp_t_data_t* t1,
   struct _fx_T2R9Ast__id_tLT2R9Ast__id_tN14K_form__ktyp_t* fx_result)
{
   fx_result->t0 = *t0;
   FX_COPY_PTR(t1, &fx_result->t1);
}

static void _fx_free_T2iN14K_form__ktyp_t(struct _fx_T2iN14K_form__ktyp_t* dst)
{
   _fx_free_N14K_form__ktyp_t(&dst->t1);
}

static void _fx_copy_T2iN14K_form__ktyp_t(struct _fx_T2iN14K_form__ktyp_t* src, struct _fx_T2iN14K_form__ktyp_t* dst)
{
   dst->t0 = src->t0;
   FX_COPY_PTR(src->t1, &dst->t1);
}

static void _fx_make_T2iN14K_form__ktyp_t(
   int_ t0,
   struct _fx_N14K_form__ktyp_t_data_t* t1,
   struct _fx_T2iN14K_form__ktyp_t* fx_result)
{
   fx_result->t0 = t0;
   FX_COPY_PTR(t1, &fx_result->t1);
}

static void _fx_free_N14K_form__ktyp_t(struct _fx_N14K_form__ktyp_t_data_t** dst)
{
   if (*dst && FX_DECREF((*dst)->rc) == 1) {
      switch ((*dst)->tag) {
      case 12:
         _fx_free_N14K_form__ktyp_t(&(*dst)->u.KTypRawPointer); break;
      case 13:
         _fx_free_T2LN14K_form__ktyp_tN14K_form__ktyp_t(&(*dst)->u.KTypFun); break;
      case 14:
         _fx_free_LN14K_form__ktyp_t(&(*dst)->u.KTypTuple); break;
      case 15:
         _fx_free_T2R9Ast__id_tLT2R9Ast__id_tN14K_form__ktyp_t(&(*dst)->u.KTypRecord); break;
      case 17:
         _fx_free_T2iN14K_form__ktyp_t(&(*dst)->u.KTypArray); break;
      case 18:
         _fx_free_N14K_form__ktyp_t(&(*dst)->u.KTypVector); break;
      case 19:
         _fx_free_N14K_form__ktyp_t(&(*dst)->u.KTypList); break;
      case 20:
         _fx_free_N14K_form__ktyp_t(&(*dst)->u.KTypRef); break;
      default:
         ;
      }
      fx_free(*dst);
   }
   *dst = 0;
}

static void _fx_free_Ta3N14K_form__atom_t(struct _fx_Ta3N14K_form__atom_t* dst)
{
   _fx_free_N14K_form__atom_t(&dst->t0);
   _fx_free_N14K_form__atom_t(&dst->t1);
   _fx_free_N14K_form__atom_t(&dst->t2);
}

static void _fx_copy_Ta3N14K_form__atom_t(struct _fx_Ta3N14K_form__atom_t* src, struct _fx_Ta3N14K_form__atom_t* dst)
{
   _fx_copy_N14K_form__atom_t(&src->t0, &dst->t0);
   _fx_copy_N14K_form__atom_t(&src->t1, &dst->t1);
   _fx_copy_N14K_form__atom_t(&src->t2, &dst->t2);
}

static void _fx_make_Ta3N14K_form__atom_t(
   struct _fx_N14K_form__atom_t* t0,
   struct _fx_N14K_form__atom_t* t1,
   struct _fx_N14K_form__atom_t* t2,
   struct _fx_Ta3N14K_form__atom_t* fx_result)
{
   _fx_copy_N14K_form__atom_t(t0, &fx_result->t0);
   _fx_copy_N14K_form__atom_t(t1, &fx_result->t1);
   _fx_copy_N14K_form__atom_t(t2, &fx_result->t2);
}

static void _fx_free_N13K_form__dom_t(struct _fx_N13K_form__dom_t* dst)
{
   switch (dst->tag) {
   case 1:
      _fx_free_N14K_form__atom_t(&dst->u.DomainElem); break;
   case 2:
      _fx_free_N14K_form__atom_t(&dst->u.DomainFast); break;
   case 3:
      _fx_free_Ta3N14K_form__atom_t(&dst->u.DomainRange); break;
   default:
      ;
   }
   dst->tag = 0;
}

static void _fx_copy_N13K_form__dom_t(struct _fx_N13K_form__dom_t* src, struct _fx_N13K_form__dom_t* dst)
{
   dst->tag = src->tag;
   switch (src->tag) {
   case 1:
      _fx_copy_N14K_form__atom_t(&src->u.DomainElem, &dst->u.DomainElem); break;
   case 2:
      _fx_copy_N14K_form__atom_t(&src->u.DomainFast, &dst->u.DomainFast); break;
   case 3:
      _fx_copy_Ta3N14K_form__atom_t(&src->u.DomainRange, &dst->u.DomainRange); break;
   default:
      dst->u = src->u;
   }
}

static void _fx_free_T2Nt6option1N14K_form__atom_tR10Ast__loc_t(struct _fx_T2Nt6option1N14K_form__atom_tR10Ast__loc_t* dst)
{
   _fx_free_Nt6option1N14K_form__atom_t(&dst->t0);
}

static void _fx_copy_T2Nt6option1N14K_form__atom_tR10Ast__loc_t(
   struct _fx_T2Nt6option1N14K_form__atom_tR10Ast__loc_t* src,
   struct _fx_T2Nt6option1N14K_form__atom_tR10Ast__loc_t* dst)
{
   _fx_copy_Nt6option1N14K_form__atom_t(&src->t0, &dst->t0);
   dst->t1 = src->t1;
}

static void _fx_make_T2Nt6option1N14K_form__atom_tR10Ast__loc_t(
   struct _fx_Nt6option1N14K_form__atom_t* t0,
   struct _fx_R10Ast__loc_t* t1,
   struct _fx_T2Nt6option1N14K_form__atom_tR10Ast__loc_t* fx_result)
{
   _fx_copy_Nt6option1N14K_form__atom_t(t0, &fx_result->t0);
   fx_result->t1 = *t1;
}

static void _fx_free_T2N14K_form__ktyp_tR10Ast__loc_t(struct _fx_T2N14K_form__ktyp_tR10Ast__loc_t* dst)
{
   _fx_free_N14K_form__ktyp_t(&dst->t0);
}

static void _fx_copy_T2N14K_form__ktyp_tR10Ast__loc_t(
   struct _fx_T2N14K_form__ktyp_tR10Ast__loc_t* src,
   struct _fx_T2N14K_form__ktyp_tR10Ast__loc_t* dst)
{
   FX_COPY_PTR(src->t0, &dst->t0);
   dst->t1 = src->t1;
}

static void _fx_make_T2N14K_form__ktyp_tR10Ast__loc_t(
   struct _fx_N14K_form__ktyp_t_data_t* t0,
   struct _fx_R10Ast__loc_t* t1,
   struct _fx_T2N14K_form__ktyp_tR10Ast__loc_t* fx_result)
{
   FX_COPY_PTR(t0, &fx_result->t0);
   fx_result->t1 = *t1;
}

static void _fx_free_T2N14K_form__atom_tT2N14K_form__ktyp_tR10Ast__loc_t(
   struct _fx_T2N14K_form__atom_tT2N14K_form__ktyp_tR10Ast__loc_t* dst)
{
   _fx_free_N14K_form__atom_t(&dst->t0);
   _fx_free_T2N14K_form__ktyp_tR10Ast__loc_t(&dst->t1);
}

static void _fx_copy_T2N14K_form__atom_tT2N14K_form__ktyp_tR10Ast__loc_t(
   struct _fx_T2N14K_form__atom_tT2N14K_form__ktyp_tR10Ast__loc_t* src,
   struct _fx_T2N14K_form__atom_tT2N14K_form__ktyp_tR10Ast__loc_t* dst)
{
   _fx_copy_N14K_form__atom_t(&src->t0, &dst->t0);
   _fx_copy_T2N14K_form__ktyp_tR10Ast__loc_t(&src->t1, &dst->t1);
}

static void _fx_make_T2N14K_form__atom_tT2N14K_form__ktyp_tR10Ast__loc_t(
   struct _fx_N14K_form__atom_t* t0,
   struct _fx_T2N14K_form__ktyp_tR10Ast__loc_t* t1,
   struct _fx_T2N14K_form__atom_tT2N14K_form__ktyp_tR10Ast__loc_t* fx_result)
{
   _fx_copy_N14K_form__atom_t(t0, &fx_result->t0);
   _fx_copy_T2N14K_form__ktyp_tR10Ast__loc_t(t1, &fx_result->t1);
}

static void _fx_free_T4N13Ast__binary_tN14K_form__atom_tN14K_form__atom_tT2N14K_form__ktyp_tR10Ast__loc_t(
   struct _fx_T4N13Ast__binary_tN14K_form__atom_tN14K_form__atom_tT2N14K_form__ktyp_tR10Ast__loc_t* dst)
{
   _fx_free_N13Ast__binary_t(&dst->t0);
   _fx_free_N14K_form__atom_t(&dst->t1);
   _fx_free_N14K_form__atom_t(&dst->t2);
   _fx_free_T2N14K_form__ktyp_tR10Ast__loc_t(&dst->t3);
}

static void _fx_copy_T4N13Ast__binary_tN14K_form__atom_tN14K_form__atom_tT2N14K_form__ktyp_tR10Ast__loc_t(
   struct _fx_T4N13Ast__binary_tN14K_form__atom_tN14K_form__atom_tT2N14K_form__ktyp_tR10Ast__loc_t* src,
   struct _fx_T4N13Ast__binary_tN14K_form__atom_tN14K_form__atom_tT2N14K_form__ktyp_tR10Ast__loc_t* dst)
{
   FX_COPY_PTR(src->t0, &dst->t0);
   _fx_copy_N14K_form__atom_t(&src->t1, &dst->t1);
   _fx_copy_N14K_form__atom_t(&src->t2, &dst->t2);
   _fx_copy_T2N14K_form__ktyp_tR10Ast__loc_t(&src->t3, &dst->t3);
}

static void _fx_make_T4N13Ast__binary_tN14K_form__atom_tN14K_form__atom_tT2N14K_form__ktyp_tR10Ast__loc_t(
   struct _fx_N13Ast__binary_t_data_t* t0,
   struct _fx_N14K_form__atom_t* t1,
   struct _fx_N14K_form__atom_t* t2,
   struct _fx_T2N14K_form__ktyp_tR10Ast__loc_t* t3,
   struct _fx_T4N13Ast__binary_tN14K_form__atom_tN14K_form__atom_tT2N14K_form__ktyp_tR10Ast__loc_t* fx_result)
{
   FX_COPY_PTR(t0, &fx_result->t0);
   _fx_copy_N14K_form__atom_t(t1, &fx_result->t1);
   _fx_copy_N14K_form__atom_t(t2, &fx_result->t2);
   _fx_copy_T2N14K_form__ktyp_tR10Ast__loc_t(t3, &fx_result->t3);
}

static void _fx_free_T3N12Ast__unary_tN14K_form__atom_tT2N14K_form__ktyp_tR10Ast__loc_t(
   struct _fx_T3N12Ast__unary_tN14K_form__atom_tT2N14K_form__ktyp_tR10Ast__loc_t* dst)
{
   _fx_free_N14K_form__atom_t(&dst->t1);
   _fx_free_T2N14K_form__ktyp_tR10Ast__loc_t(&dst->t2);
}

static void _fx_copy_T3N12Ast__unary_tN14K_form__atom_tT2N14K_form__ktyp_tR10Ast__loc_t(
   struct _fx_T3N12Ast__unary_tN14K_form__atom_tT2N14K_form__ktyp_tR10Ast__loc_t* src,
   struct _fx_T3N12Ast__unary_tN14K_form__atom_tT2N14K_form__ktyp_tR10Ast__loc_t* dst)
{
   dst->t0 = src->t0;
   _fx_copy_N14K_form__atom_t(&src->t1, &dst->t1);
   _fx_copy_T2N14K_form__ktyp_tR10Ast__loc_t(&src->t2, &dst->t2);
}

static void _fx_make_T3N12Ast__unary_tN14K_form__atom_tT2N14K_form__ktyp_tR10Ast__loc_t(
   struct _fx_N12Ast__unary_t* t0,
   struct _fx_N14K_form__atom_t* t1,
   struct _fx_T2N14K_form__ktyp_tR10Ast__loc_t* t2,
   struct _fx_T3N12Ast__unary_tN14K_form__atom_tT2N14K_form__ktyp_tR10Ast__loc_t* fx_result)
{
   fx_result->t0 = *t0;
   _fx_copy_N14K_form__atom_t(t1, &fx_result->t1);
   _fx_copy_T2N14K_form__ktyp_tR10Ast__loc_t(t2, &fx_result->t2);
}

static void _fx_free_LN14K_form__atom_t(struct _fx_LN14K_form__atom_t_data_t** dst)
{
   FX_FREE_LIST_IMPL(_fx_LN14K_form__atom_t, _fx_free_N14K_form__atom_t);
}

static int _fx_cons_LN14K_form__atom_t(
   struct _fx_N14K_form__atom_t* hd,
   struct _fx_LN14K_form__atom_t_data_t* tl,
   bool addref_tl,
   struct _fx_LN14K_form__atom_t_data_t** fx_result)
{
   FX_MAKE_LIST_IMPL(_fx_LN14K_form__atom_t, _fx_copy_N14K_form__atom_t);
}

static void _fx_free_T3N13Ast__intrin_tLN14K_form__atom_tT2N14K_form__ktyp_tR10Ast__loc_t(
   struct _fx_T3N13Ast__intrin_tLN14K_form__atom_tT2N14K_form__ktyp_tR10Ast__loc_t* dst)
{
   _fx_free_LN14K_form__atom_t(&dst->t1);
   _fx_free_T2N14K_form__ktyp_tR10Ast__loc_t(&dst->t2);
}

static void _fx_copy_T3N13Ast__intrin_tLN14K_form__atom_tT2N14K_form__ktyp_tR10Ast__loc_t(
   struct _fx_T3N13Ast__intrin_tLN14K_form__atom_tT2N14K_form__ktyp_tR10Ast__loc_t* src,
   struct _fx_T3N13Ast__intrin_tLN14K_form__atom_tT2N14K_form__ktyp_tR10Ast__loc_t* dst)
{
   dst->t0 = src->t0;
   FX_COPY_PTR(src->t1, &dst->t1);
   _fx_copy_T2N14K_form__ktyp_tR10Ast__loc_t(&src->t2, &dst->t2);
}

static void _fx_make_T3N13Ast__intrin_tLN14K_form__atom_tT2N14K_form__ktyp_tR10Ast__loc_t(
   struct _fx_N13Ast__intrin_t* t0,
   struct _fx_LN14K_form__atom_t_data_t* t1,
   struct _fx_T2N14K_form__ktyp_tR10Ast__loc_t* t2,
   struct _fx_T3N13Ast__intrin_tLN14K_form__atom_tT2N14K_form__ktyp_tR10Ast__loc_t* fx_result)
{
   fx_result->t0 = *t0;
   FX_COPY_PTR(t1, &fx_result->t1);
   _fx_copy_T2N14K_form__ktyp_tR10Ast__loc_t(t2, &fx_result->t2);
}

static void _fx_free_T2R9Ast__id_tN14K_form__kexp_t(struct _fx_T2R9Ast__id_tN14K_form__kexp_t* dst)
{
   _fx_free_N14K_form__kexp_t(&dst->t1);
}

static void _fx_copy_T2R9Ast__id_tN14K_form__kexp_t(
   struct _fx_T2R9Ast__id_tN14K_form__kexp_t* src,
   struct _fx_T2R9Ast__id_tN14K_form__kexp_t* dst)
{
   dst->t0 = src->t0;
   FX_COPY_PTR(src->t1, &dst->t1);
}

static void _fx_make_T2R9Ast__id_tN14K_form__kexp_t(
   struct _fx_R9Ast__id_t* t0,
   struct _fx_N14K_form__kexp_t_data_t* t1,
   struct _fx_T2R9Ast__id_tN14K_form__kexp_t* fx_result)
{
   fx_result->t0 = *t0;
   FX_COPY_PTR(t1, &fx_result->t1);
}

static void _fx_free_T2LN14K_form__kexp_tT2N14K_form__ktyp_tR10Ast__loc_t(
   struct _fx_T2LN14K_form__kexp_tT2N14K_form__ktyp_tR10Ast__loc_t* dst)
{
   _fx_free_LN14K_form__kexp_t(&dst->t0);
   _fx_free_T2N14K_form__ktyp_tR10Ast__loc_t(&dst->t1);
}

static void _fx_copy_T2LN14K_form__kexp_tT2N14K_form__ktyp_tR10Ast__loc_t(
   struct _fx_T2LN14K_form__kexp_tT2N14K_form__ktyp_tR10Ast__loc_t* src,
   struct _fx_T2LN14K_form__kexp_tT2N14K_form__ktyp_tR10Ast__loc_t* dst)
{
   FX_COPY_PTR(src->t0, &dst->t0);
   _fx_copy_T2N14K_form__ktyp_tR10Ast__loc_t(&src->t1, &dst->t1);
}

static void _fx_make_T2LN14K_form__kexp_tT2N14K_form__ktyp_tR10Ast__loc_t(
   struct _fx_LN14K_form__kexp_t_data_t* t0,
   struct _fx_T2N14K_form__ktyp_tR10Ast__loc_t* t1,
   struct _fx_T2LN14K_form__kexp_tT2N14K_form__ktyp_tR10Ast__loc_t* fx_result)
{
   FX_COPY_PTR(t0, &fx_result->t0);
   _fx_copy_T2N14K_form__ktyp_tR10Ast__loc_t(t1, &fx_result->t1);
}

static void _fx_free_T4N14K_form__kexp_tN14K_form__kexp_tN14K_form__kexp_tT2N14K_form__ktyp_tR10Ast__loc_t(
   struct _fx_T4N14K_form__kexp_tN14K_form__kexp_tN14K_form__kexp_tT2N14K_form__ktyp_tR10Ast__loc_t* dst)
{
   _fx_free_N14K_form__kexp_t(&dst->t0);
   _fx_free_N14K_form__kexp_t(&dst->t1);
   _fx_free_N14K_form__kexp_t(&dst->t2);
   _fx_free_T2N14K_form__ktyp_tR10Ast__loc_t(&dst->t3);
}

static void _fx_copy_T4N14K_form__kexp_tN14K_form__kexp_tN14K_form__kexp_tT2N14K_form__ktyp_tR10Ast__loc_t(
   struct _fx_T4N14K_form__kexp_tN14K_form__kexp_tN14K_form__kexp_tT2N14K_form__ktyp_tR10Ast__loc_t* src,
   struct _fx_T4N14K_form__kexp_tN14K_form__kexp_tN14K_form__kexp_tT2N14K_form__ktyp_tR10Ast__loc_t* dst)
{
   FX_COPY_PTR(src->t0, &dst->t0);
   FX_COPY_PTR(src->t1, &dst->t1);
   FX_COPY_PTR(src->t2, &dst->t2);
   _fx_copy_T2N14K_form__ktyp_tR10Ast__loc_t(&src->t3, &dst->t3);
}

static void _fx_make_T4N14K_form__kexp_tN14K_form__kexp_tN14K_form__kexp_tT2N14K_form__ktyp_tR10Ast__loc_t(
   struct _fx_N14K_form__kexp_t_data_t* t0,
   struct _fx_N14K_form__kexp_t_data_t* t1,
   struct _fx_N14K_form__kexp_t_data_t* t2,
   struct _fx_T2N14K_form__ktyp_tR10Ast__loc_t* t3,
   struct _fx_T4N14K_form__kexp_tN14K_form__kexp_tN14K_form__kexp_tT2N14K_form__ktyp_tR10Ast__loc_t* fx_result)
{
   FX_COPY_PTR(t0, &fx_result->t0);
   FX_COPY_PTR(t1, &fx_result->t1);
   FX_COPY_PTR(t2, &fx_result->t2);
   _fx_copy_T2N14K_form__ktyp_tR10Ast__loc_t(t3, &fx_result->t3);
}

static void _fx_free_T3R9Ast__id_tLN14K_form__atom_tT2N14K_form__ktyp_tR10Ast__loc_t(
   struct _fx_T3R9Ast__id_tLN14K_form__atom_tT2N14K_form__ktyp_tR10Ast__loc_t* dst)
{
   _fx_free_LN14K_form__atom_t(&dst->t1);
   _fx_free_T2N14K_form__ktyp_tR10Ast__loc_t(&dst->t2);
}

static void _fx_copy_T3R9Ast__id_tLN14K_form__atom_tT2N14K_form__ktyp_tR10Ast__loc_t(
   struct _fx_T3R9Ast__id_tLN14K_form__atom_tT2N14K_form__ktyp_tR10Ast__loc_t* src,
   struct _fx_T3R9Ast__id_tLN14K_form__atom_tT2N14K_form__ktyp_tR10Ast__loc_t* dst)
{
   dst->t0 = src->t0;
   FX_COPY_PTR(src->t1, &dst->t1);
   _fx_copy_T2N14K_form__ktyp_tR10Ast__loc_t(&src->t2, &dst->t2);
}

static void _fx_make_T3R9Ast__id_tLN14K_form__atom_tT2N14K_form__ktyp_tR10Ast__loc_t(
   struct _fx_R9Ast__id_t* t0,
   struct _fx_LN14K_form__atom_t_data_t* t1,
   struct _fx_T2N14K_form__ktyp_tR10Ast__loc_t* t2,
   struct _fx_T3R9Ast__id_tLN14K_form__atom_tT2N14K_form__ktyp_tR10Ast__loc_t* fx_result)
{
   fx_result->t0 = *t0;
   FX_COPY_PTR(t1, &fx_result->t1);
   _fx_copy_T2N14K_form__ktyp_tR10Ast__loc_t(t2, &fx_result->t2);
}

static void _fx_free_T4R9Ast__id_tiLN14K_form__atom_tT2N14K_form__ktyp_tR10Ast__loc_t(
   struct _fx_T4R9Ast__id_tiLN14K_form__atom_tT2N14K_form__ktyp_tR10Ast__loc_t* dst)
{
   _fx_free_LN14K_form__atom_t(&dst->t2);
   _fx_free_T2N14K_form__ktyp_tR10Ast__loc_t(&dst->t3);
}

static void _fx_copy_T4R9Ast__id_tiLN14K_form__atom_tT2N14K_form__ktyp_tR10Ast__loc_t(
   struct _fx_T4R9Ast__id_tiLN14K_form__atom_tT2N14K_form__ktyp_tR10Ast__loc_t* src,
   struct _fx_T4R9Ast__id_tiLN14K_form__atom_tT2N14K_form__ktyp_tR10Ast__loc_t* dst)
{
   dst->t0 = src->t0;
   dst->t1 = src->t1;
   FX_COPY_PTR(src->t2, &dst->t2);
   _fx_copy_T2N14K_form__ktyp_tR10Ast__loc_t(&src->t3, &dst->t3);
}

static void _fx_make_T4R9Ast__id_tiLN14K_form__atom_tT2N14K_form__ktyp_tR10Ast__loc_t(
   struct _fx_R9Ast__id_t* t0,
   int_ t1,
   struct _fx_LN14K_form__atom_t_data_t* t2,
   struct _fx_T2N14K_form__ktyp_tR10Ast__loc_t* t3,
   struct _fx_T4R9Ast__id_tiLN14K_form__atom_tT2N14K_form__ktyp_tR10Ast__loc_t* fx_result)
{
   fx_result->t0 = *t0;
   fx_result->t1 = t1;
   FX_COPY_PTR(t2, &fx_result->t2);
   _fx_copy_T2N14K_form__ktyp_tR10Ast__loc_t(t3, &fx_result->t3);
}

static void _fx_free_T2LN14K_form__atom_tT2N14K_form__ktyp_tR10Ast__loc_t(
   struct _fx_T2LN14K_form__atom_tT2N14K_form__ktyp_tR10Ast__loc_t* dst)
{
   _fx_free_LN14K_form__atom_t(&dst->t0);
   _fx_free_T2N14K_form__ktyp_tR10Ast__loc_t(&dst->t1);
}

static void _fx_copy_T2LN14K_form__atom_tT2N14K_form__ktyp_tR10Ast__loc_t(
   struct _fx_T2LN14K_form__atom_tT2N14K_form__ktyp_tR10Ast__loc_t* src,
   struct _fx_T2LN14K_form__atom_tT2N14K_form__ktyp_tR10Ast__loc_t* dst)
{
   FX_COPY_PTR(src->t0, &dst->t0);
   _fx_copy_T2N14K_form__ktyp_tR10Ast__loc_t(&src->t1, &dst->t1);
}

static void _fx_make_T2LN14K_form__atom_tT2N14K_form__ktyp_tR10Ast__loc_t(
   struct _fx_LN14K_form__atom_t_data_t* t0,
   struct _fx_T2N14K_form__ktyp_tR10Ast__loc_t* t1,
   struct _fx_T2LN14K_form__atom_tT2N14K_form__ktyp_tR10Ast__loc_t* fx_result)
{
   FX_COPY_PTR(t0, &fx_result->t0);
   _fx_copy_T2N14K_form__ktyp_tR10Ast__loc_t(t1, &fx_result->t1);
}

static void _fx_free_T4R9Ast__id_tR9Ast__id_tLN14K_form__atom_tT2N14K_form__ktyp_tR10Ast__loc_t(
   struct _fx_T4R9Ast__id_tR9Ast__id_tLN14K_form__atom_tT2N14K_form__ktyp_tR10Ast__loc_t* dst)
{
   _fx_free_LN14K_form__atom_t(&dst->t2);
   _fx_free_T2N14K_form__ktyp_tR10Ast__loc_t(&dst->t3);
}

static void _fx_copy_T4R9Ast__id_tR9Ast__id_tLN14K_form__atom_tT2N14K_form__ktyp_tR10Ast__loc_t(
   struct _fx_T4R9Ast__id_tR9Ast__id_tLN14K_form__atom_tT2N14K_form__ktyp_tR10Ast__loc_t* src,
   struct _fx_T4R9Ast__id_tR9Ast__id_tLN14K_form__atom_tT2N14K_form__ktyp_tR10Ast__loc_t* dst)
{
   dst->t0 = src->t0;
   dst->t1 = src->t1;
   FX_COPY_PTR(src->t2, &dst->t2);
   _fx_copy_T2N14K_form__ktyp_tR10Ast__loc_t(&src->t3, &dst->t3);
}

static void _fx_make_T4R9Ast__id_tR9Ast__id_tLN14K_form__atom_tT2N14K_form__ktyp_tR10Ast__loc_t(
   struct _fx_R9Ast__id_t* t0,
   struct _fx_R9Ast__id_t* t1,
   struct _fx_LN14K_form__atom_t_data_t* t2,
   struct _fx_T2N14K_form__ktyp_tR10Ast__loc_t* t3,
   struct _fx_T4R9Ast__id_tR9Ast__id_tLN14K_form__atom_tT2N14K_form__ktyp_tR10Ast__loc_t* fx_result)
{
   fx_result->t0 = *t0;
   fx_result->t1 = *t1;
   FX_COPY_PTR(t2, &fx_result->t2);
   _fx_copy_T2N14K_form__ktyp_tR10Ast__loc_t(t3, &fx_result->t3);
}

static void _fx_free_LLT2BN14K_form__atom_t(struct _fx_LLT2BN14K_form__atom_t_data_t** dst)
{
   FX_FREE_LIST_IMPL(_fx_LLT2BN14K_form__atom_t, _fx_free_LT2BN14K_form__atom_t);
}

static int _fx_cons_LLT2BN14K_form__atom_t(
   struct _fx_LT2BN14K_form__atom_t_data_t* hd,
   struct _fx_LLT2BN14K_form__atom_t_data_t* tl,
   bool addref_tl,
   struct _fx_LLT2BN14K_form__atom_t_data_t** fx_result)
{
   FX_MAKE_LIST_IMPL(_fx_LLT2BN14K_form__atom_t, FX_COPY_PTR);
}

static void _fx_free_T3BLLT2BN14K_form__atom_tT2N14K_form__ktyp_tR10Ast__loc_t(
   struct _fx_T3BLLT2BN14K_form__atom_tT2N14K_form__ktyp_tR10Ast__loc_t* dst)
{
   _fx_free_LLT2BN14K_form__atom_t(&dst->t1);
   _fx_free_T2N14K_form__ktyp_tR10Ast__loc_t(&dst->t2);
}

static void _fx_copy_T3BLLT2BN14K_form__atom_tT2N14K_form__ktyp_tR10Ast__loc_t(
   struct _fx_T3BLLT2BN14K_form__atom_tT2N14K_form__ktyp_tR10Ast__loc_t* src,
   struct _fx_T3BLLT2BN14K_form__atom_tT2N14K_form__ktyp_tR10Ast__loc_t* dst)
{
   dst->t0 = src->t0;
   FX_COPY_PTR(src->t1, &dst->t1);
   _fx_copy_T2N14K_form__ktyp_tR10Ast__loc_t(&src->t2, &dst->t2);
}

static void _fx_make_T3BLLT2BN14K_form__atom_tT2N14K_form__ktyp_tR10Ast__loc_t(
   bool t0,
   struct _fx_LLT2BN14K_form__atom_t_data_t* t1,
   struct _fx_T2N14K_form__ktyp_tR10Ast__loc_t* t2,
   struct _fx_T3BLLT2BN14K_form__atom_tT2N14K_form__ktyp_tR10Ast__loc_t* fx_result)
{
   fx_result->t0 = t0;
   FX_COPY_PTR(t1, &fx_result->t1);
   _fx_copy_T2N14K_form__ktyp_tR10Ast__loc_t(t2, &fx_result->t2);
}

static void _fx_free_T2LT2BN14K_form__atom_tT2N14K_form__ktyp_tR10Ast__loc_t(
   struct _fx_T2LT2BN14K_form__atom_tT2N14K_form__ktyp_tR10Ast__loc_t* dst)
{
   _fx_free_LT2BN14K_form__atom_t(&dst->t0);
   _fx_free_T2N14K_form__ktyp_tR10Ast__loc_t(&dst->t1);
}

static void _fx_copy_T2LT2BN14K_form__atom_tT2N14K_form__ktyp_tR10Ast__loc_t(
   struct _fx_T2LT2BN14K_form__atom_tT2N14K_form__ktyp_tR10Ast__loc_t* src,
   struct _fx_T2LT2BN14K_form__atom_tT2N14K_form__ktyp_tR10Ast__loc_t* dst)
{
   FX_COPY_PTR(src->t0, &dst->t0);
   _fx_copy_T2N14K_form__ktyp_tR10Ast__loc_t(&src->t1, &dst->t1);
}

static void _fx_make_T2LT2BN14K_form__atom_tT2N14K_form__ktyp_tR10Ast__loc_t(
   struct _fx_LT2BN14K_form__atom_t_data_t* t0,
   struct _fx_T2N14K_form__ktyp_tR10Ast__loc_t* t1,
   struct _fx_T2LT2BN14K_form__atom_tT2N14K_form__ktyp_tR10Ast__loc_t* fx_result)
{
   FX_COPY_PTR(t0, &fx_result->t0);
   _fx_copy_T2N14K_form__ktyp_tR10Ast__loc_t(t1, &fx_result->t1);
}

static void _fx_free_LN13K_form__dom_t(struct _fx_LN13K_form__dom_t_data_t** dst)
{
   FX_FREE_LIST_IMPL(_fx_LN13K_form__dom_t, _fx_free_N13K_form__dom_t);
}

static int _fx_cons_LN13K_form__dom_t(
   struct _fx_N13K_form__dom_t* hd,
   struct _fx_LN13K_form__dom_t_data_t* tl,
   bool addref_tl,
   struct _fx_LN13K_form__dom_t_data_t** fx_result)
{
   FX_MAKE_LIST_IMPL(_fx_LN13K_form__dom_t, _fx_copy_N13K_form__dom_t);
}

static void _fx_free_T5N14K_form__atom_tN13Ast__border_tN18Ast__interpolate_tLN13K_form__dom_tT2N14K_form__ktyp_tR10Ast__loc_t(
   struct _fx_T5N14K_form__atom_tN13Ast__border_tN18Ast__interpolate_tLN13K_form__dom_tT2N14K_form__ktyp_tR10Ast__loc_t* dst)
{
   _fx_free_N14K_form__atom_t(&dst->t0);
   _fx_free_LN13K_form__dom_t(&dst->t3);
   _fx_free_T2N14K_form__ktyp_tR10Ast__loc_t(&dst->t4);
}

static void _fx_copy_T5N14K_form__atom_tN13Ast__border_tN18Ast__interpolate_tLN13K_form__dom_tT2N14K_form__ktyp_tR10Ast__loc_t(
   struct _fx_T5N14K_form__atom_tN13Ast__border_tN18Ast__interpolate_tLN13K_form__dom_tT2N14K_form__ktyp_tR10Ast__loc_t* src,
   struct _fx_T5N14K_form__atom_tN13Ast__border_tN18Ast__interpolate_tLN13K_form__dom_tT2N14K_form__ktyp_tR10Ast__loc_t* dst)
{
   _fx_copy_N14K_form__atom_t(&src->t0, &dst->t0);
   dst->t1 = src->t1;
   dst->t2 = src->t2;
   FX_COPY_PTR(src->t3, &dst->t3);
   _fx_copy_T2N14K_form__ktyp_tR10Ast__loc_t(&src->t4, &dst->t4);
}

static void _fx_make_T5N14K_form__atom_tN13Ast__border_tN18Ast__interpolate_tLN13K_form__dom_tT2N14K_form__ktyp_tR10Ast__loc_t(
   struct _fx_N14K_form__atom_t* t0,
   struct _fx_N13Ast__border_t* t1,
   struct _fx_N18Ast__interpolate_t* t2,
   struct _fx_LN13K_form__dom_t_data_t* t3,
   struct _fx_T2N14K_form__ktyp_tR10Ast__loc_t* t4,
   struct _fx_T5N14K_form__atom_tN13Ast__border_tN18Ast__interpolate_tLN13K_form__dom_tT2N14K_form__ktyp_tR10Ast__loc_t*
      fx_result)
{
   _fx_copy_N14K_form__atom_t(t0, &fx_result->t0);
   fx_result->t1 = *t1;
   fx_result->t2 = *t2;
   FX_COPY_PTR(t3, &fx_result->t3);
   _fx_copy_T2N14K_form__ktyp_tR10Ast__loc_t(t4, &fx_result->t4);
}

static void _fx_free_T3R9Ast__id_tiT2N14K_form__ktyp_tR10Ast__loc_t(
   struct _fx_T3R9Ast__id_tiT2N14K_form__ktyp_tR10Ast__loc_t* dst)
{
   _fx_free_T2N14K_form__ktyp_tR10Ast__loc_t(&dst->t2);
}

static void _fx_copy_T3R9Ast__id_tiT2N14K_form__ktyp_tR10Ast__loc_t(
   struct _fx_T3R9Ast__id_tiT2N14K_form__ktyp_tR10Ast__loc_t* src,
   struct _fx_T3R9Ast__id_tiT2N14K_form__ktyp_tR10Ast__loc_t* dst)
{
   dst->t0 = src->t0;
   dst->t1 = src->t1;
   _fx_copy_T2N14K_form__ktyp_tR10Ast__loc_t(&src->t2, &dst->t2);
}

static void _fx_make_T3R9Ast__id_tiT2N14K_form__ktyp_tR10Ast__loc_t(
   struct _fx_R9Ast__id_t* t0,
   int_ t1,
   struct _fx_T2N14K_form__ktyp_tR10Ast__loc_t* t2,
   struct _fx_T3R9Ast__id_tiT2N14K_form__ktyp_tR10Ast__loc_t* fx_result)
{
   fx_result->t0 = *t0;
   fx_result->t1 = t1;
   _fx_copy_T2N14K_form__ktyp_tR10Ast__loc_t(t2, &fx_result->t2);
}

static void _fx_free_T3R9Ast__id_tN14K_form__atom_tR10Ast__loc_t(struct _fx_T3R9Ast__id_tN14K_form__atom_tR10Ast__loc_t* dst)
{
   _fx_free_N14K_form__atom_t(&dst->t1);
}

static void _fx_copy_T3R9Ast__id_tN14K_form__atom_tR10Ast__loc_t(
   struct _fx_T3R9Ast__id_tN14K_form__atom_tR10Ast__loc_t* src,
   struct _fx_T3R9Ast__id_tN14K_form__atom_tR10Ast__loc_t* dst)
{
   dst->t0 = src->t0;
   _fx_copy_N14K_form__atom_t(&src->t1, &dst->t1);
   dst->t2 = src->t2;
}

static void _fx_make_T3R9Ast__id_tN14K_form__atom_tR10Ast__loc_t(
   struct _fx_R9Ast__id_t* t0,
   struct _fx_N14K_form__atom_t* t1,
   struct _fx_R10Ast__loc_t* t2,
   struct _fx_T3R9Ast__id_tN14K_form__atom_tR10Ast__loc_t* fx_result)
{
   fx_result->t0 = *t0;
   _fx_copy_N14K_form__atom_t(t1, &fx_result->t1);
   fx_result->t2 = *t2;
}

static void _fx_free_T2LN14K_form__kexp_tN14K_form__kexp_t(struct _fx_T2LN14K_form__kexp_tN14K_form__kexp_t* dst)
{
   _fx_free_LN14K_form__kexp_t(&dst->t0);
   _fx_free_N14K_form__kexp_t(&dst->t1);
}

static void _fx_copy_T2LN14K_form__kexp_tN14K_form__kexp_t(
   struct _fx_T2LN14K_form__kexp_tN14K_form__kexp_t* src,
   struct _fx_T2LN14K_form__kexp_tN14K_form__kexp_t* dst)
{
   FX_COPY_PTR(src->t0, &dst->t0);
   FX_COPY_PTR(src->t1, &dst->t1);
}

static void _fx_make_T2LN14K_form__kexp_tN14K_form__kexp_t(
   struct _fx_LN14K_form__kexp_t_data_t* t0,
   struct _fx_N14K_form__kexp_t_data_t* t1,
   struct _fx_T2LN14K_form__kexp_tN14K_form__kexp_t* fx_result)
{
   FX_COPY_PTR(t0, &fx_result->t0);
   FX_COPY_PTR(t1, &fx_result->t1);
}

static void _fx_free_LT2LN14K_form__kexp_tN14K_form__kexp_t(struct _fx_LT2LN14K_form__kexp_tN14K_form__kexp_t_data_t** dst)
{
   FX_FREE_LIST_IMPL(_fx_LT2LN14K_form__kexp_tN14K_form__kexp_t, _fx_free_T2LN14K_form__kexp_tN14K_form__kexp_t);
}

static int _fx_cons_LT2LN14K_form__kexp_tN14K_form__kexp_t(
   struct _fx_T2LN14K_form__kexp_tN14K_form__kexp_t* hd,
   struct _fx_LT2LN14K_form__kexp_tN14K_form__kexp_t_data_t* tl,
   bool addref_tl,
   struct _fx_LT2LN14K_form__kexp_tN14K_form__kexp_t_data_t** fx_result)
{
   FX_MAKE_LIST_IMPL(_fx_LT2LN14K_form__kexp_tN14K_form__kexp_t, _fx_copy_T2LN14K_form__kexp_tN14K_form__kexp_t);
}

static void _fx_free_T2LT2LN14K_form__kexp_tN14K_form__kexp_tT2N14K_form__ktyp_tR10Ast__loc_t(
   struct _fx_T2LT2LN14K_form__kexp_tN14K_form__kexp_tT2N14K_form__ktyp_tR10Ast__loc_t* dst)
{
   _fx_free_LT2LN14K_form__kexp_tN14K_form__kexp_t(&dst->t0);
   _fx_free_T2N14K_form__ktyp_tR10Ast__loc_t(&dst->t1);
}

static void _fx_copy_T2LT2LN14K_form__kexp_tN14K_form__kexp_tT2N14K_form__ktyp_tR10Ast__loc_t(
   struct _fx_T2LT2LN14K_form__kexp_tN14K_form__kexp_tT2N14K_form__ktyp_tR10Ast__loc_t* src,
   struct _fx_T2LT2LN14K_form__kexp_tN14K_form__kexp_tT2N14K_form__ktyp_tR10Ast__loc_t* dst)
{
   FX_COPY_PTR(src->t0, &dst->t0);
   _fx_copy_T2N14K_form__ktyp_tR10Ast__loc_t(&src->t1, &dst->t1);
}

static void _fx_make_T2LT2LN14K_form__kexp_tN14K_form__kexp_tT2N14K_form__ktyp_tR10Ast__loc_t(
   struct _fx_LT2LN14K_form__kexp_tN14K_form__kexp_t_data_t* t0,
   struct _fx_T2N14K_form__ktyp_tR10Ast__loc_t* t1,
   struct _fx_T2LT2LN14K_form__kexp_tN14K_form__kexp_tT2N14K_form__ktyp_tR10Ast__loc_t* fx_result)
{
   FX_COPY_PTR(t0, &fx_result->t0);
   _fx_copy_T2N14K_form__ktyp_tR10Ast__loc_t(t1, &fx_result->t1);
}

static void _fx_free_T3N14K_form__kexp_tN14K_form__kexp_tT2N14K_form__ktyp_tR10Ast__loc_t(
   struct _fx_T3N14K_form__kexp_tN14K_form__kexp_tT2N14K_form__ktyp_tR10Ast__loc_t* dst)
{
   _fx_free_N14K_form__kexp_t(&dst->t0);
   _fx_free_N14K_form__kexp_t(&dst->t1);
   _fx_free_T2N14K_form__ktyp_tR10Ast__loc_t(&dst->t2);
}

static void _fx_copy_T3N14K_form__kexp_tN14K_form__kexp_tT2N14K_form__ktyp_tR10Ast__loc_t(
   struct _fx_T3N14K_form__kexp_tN14K_form__kexp_tT2N14K_form__ktyp_tR10Ast__loc_t* src,
   struct _fx_T3N14K_form__kexp_tN14K_form__kexp_tT2N14K_form__ktyp_tR10Ast__loc_t* dst)
{
   FX_COPY_PTR(src->t0, &dst->t0);
   FX_COPY_PTR(src->t1, &dst->t1);
   _fx_copy_T2N14K_form__ktyp_tR10Ast__loc_t(&src->t2, &dst->t2);
}

static void _fx_make_T3N14K_form__kexp_tN14K_form__kexp_tT2N14K_form__ktyp_tR10Ast__loc_t(
   struct _fx_N14K_form__kexp_t_data_t* t0,
   struct _fx_N14K_form__kexp_t_data_t* t1,
   struct _fx_T2N14K_form__ktyp_tR10Ast__loc_t* t2,
   struct _fx_T3N14K_form__kexp_tN14K_form__kexp_tT2N14K_form__ktyp_tR10Ast__loc_t* fx_result)
{
   FX_COPY_PTR(t0, &fx_result->t0);
   FX_COPY_PTR(t1, &fx_result->t1);
   _fx_copy_T2N14K_form__ktyp_tR10Ast__loc_t(t2, &fx_result->t2);
}

static void _fx_free_T3N14K_form__atom_tN14K_form__ktyp_tR10Ast__loc_t(
   struct _fx_T3N14K_form__atom_tN14K_form__ktyp_tR10Ast__loc_t* dst)
{
   _fx_free_N14K_form__atom_t(&dst->t0);
   _fx_free_N14K_form__ktyp_t(&dst->t1);
}

static void _fx_copy_T3N14K_form__atom_tN14K_form__ktyp_tR10Ast__loc_t(
   struct _fx_T3N14K_form__atom_tN14K_form__ktyp_tR10Ast__loc_t* src,
   struct _fx_T3N14K_form__atom_tN14K_form__ktyp_tR10Ast__loc_t* dst)
{
   _fx_copy_N14K_form__atom_t(&src->t0, &dst->t0);
   FX_COPY_PTR(src->t1, &dst->t1);
   dst->t2 = src->t2;
}

static void _fx_make_T3N14K_form__atom_tN14K_form__ktyp_tR10Ast__loc_t(
   struct _fx_N14K_form__atom_t* t0,
   struct _fx_N14K_form__ktyp_t_data_t* t1,
   struct _fx_R10Ast__loc_t* t2,
   struct _fx_T3N14K_form__atom_tN14K_form__ktyp_tR10Ast__loc_t* fx_result)
{
   _fx_copy_N14K_form__atom_t(t0, &fx_result->t0);
   FX_COPY_PTR(t1, &fx_result->t1);
   fx_result->t2 = *t2;
}

static void _fx_free_T2R9Ast__id_tN13K_form__dom_t(struct _fx_T2R9Ast__id_tN13K_form__dom_t* dst)
{
   _fx_free_N13K_form__dom_t(&dst->t1);
}

static void _fx_copy_T2R9Ast__id_tN13K_form__dom_t(
   struct _fx_T2R9Ast__id_tN13K_form__dom_t* src,
   struct _fx_T2R9Ast__id_tN13K_form__dom_t* dst)
{
   dst->t0 = src->t0;
   _fx_copy_N13K_form__dom_t(&src->t1, &dst->t1);
}

static void _fx_make_T2R9Ast__id_tN13K_form__dom_t(
   struct _fx_R9Ast__id_t* t0,
   struct _fx_N13K_form__dom_t* t1,
   struct _fx_T2R9Ast__id_tN13K_form__dom_t* fx_result)
{
   fx_result->t0 = *t0;
   _fx_copy_N13K_form__dom_t(t1, &fx_result->t1);
}

static void _fx_free_LT2R9Ast__id_tN13K_form__dom_t(struct _fx_LT2R9Ast__id_tN13K_form__dom_t_data_t** dst)
{
   FX_FREE_LIST_IMPL(_fx_LT2R9Ast__id_tN13K_form__dom_t, _fx_free_T2R9Ast__id_tN13K_form__dom_t);
}

static int _fx_cons_LT2R9Ast__id_tN13K_form__dom_t(
   struct _fx_T2R9Ast__id_tN13K_form__dom_t* hd,
   struct _fx_LT2R9Ast__id_tN13K_form__dom_t_data_t* tl,
   bool addref_tl,
   struct _fx_LT2R9Ast__id_tN13K_form__dom_t_data_t** fx_result)
{
   FX_MAKE_LIST_IMPL(_fx_LT2R9Ast__id_tN13K_form__dom_t, _fx_copy_T2R9Ast__id_tN13K_form__dom_t);
}

static void _fx_free_T3N14K_form__kexp_tLT2R9Ast__id_tN13K_form__dom_tLR9Ast__id_t(
   struct _fx_T3N14K_form__kexp_tLT2R9Ast__id_tN13K_form__dom_tLR9Ast__id_t* dst)
{
   _fx_free_N14K_form__kexp_t(&dst->t0);
   _fx_free_LT2R9Ast__id_tN13K_form__dom_t(&dst->t1);
   fx_free_list_simple(&dst->t2);
}

static void _fx_copy_T3N14K_form__kexp_tLT2R9Ast__id_tN13K_form__dom_tLR9Ast__id_t(
   struct _fx_T3N14K_form__kexp_tLT2R9Ast__id_tN13K_form__dom_tLR9Ast__id_t* src,
   struct _fx_T3N14K_form__kexp_tLT2R9Ast__id_tN13K_form__dom_tLR9Ast__id_t* dst)
{
   FX_COPY_PTR(src->t0, &dst->t0);
   FX_COPY_PTR(src->t1, &dst->t1);
   FX_COPY_PTR(src->t2, &dst->t2);
}

static void _fx_make_T3N14K_form__kexp_tLT2R9Ast__id_tN13K_form__dom_tLR9Ast__id_t(
   struct _fx_N14K_form__kexp_t_data_t* t0,
   struct _fx_LT2R9Ast__id_tN13K_form__dom_t_data_t* t1,
   struct _fx_LR9Ast__id_t_data_t* t2,
   struct _fx_T3N14K_form__kexp_tLT2R9Ast__id_tN13K_form__dom_tLR9Ast__id_t* fx_result)
{
   FX_COPY_PTR(t0, &fx_result->t0);
   FX_COPY_PTR(t1, &fx_result->t1);
   FX_COPY_PTR(t2, &fx_result->t2);
}

static void _fx_free_LT3N14K_form__kexp_tLT2R9Ast__id_tN13K_form__dom_tLR9Ast__id_t(
   struct _fx_LT3N14K_form__kexp_tLT2R9Ast__id_tN13K_form__dom_tLR9Ast__id_t_data_t** dst)
{
   FX_FREE_LIST_IMPL(_fx_LT3N14K_form__kexp_tLT2R9Ast__id_tN13K_form__dom_tLR9Ast__id_t,
      _fx_free_T3N14K_form__kexp_tLT2R9Ast__id_tN13K_form__dom_tLR9Ast__id_t);
}

static int _fx_cons_LT3N14K_form__kexp_tLT2R9Ast__id_tN13K_form__dom_tLR9Ast__id_t(
   struct _fx_T3N14K_form__kexp_tLT2R9Ast__id_tN13K_form__dom_tLR9Ast__id_t* hd,
   struct _fx_LT3N14K_form__kexp_tLT2R9Ast__id_tN13K_form__dom_tLR9Ast__id_t_data_t* tl,
   bool addref_tl,
   struct _fx_LT3N14K_form__kexp_tLT2R9Ast__id_tN13K_form__dom_tLR9Ast__id_t_data_t** fx_result)
{
   FX_MAKE_LIST_IMPL(_fx_LT3N14K_form__kexp_tLT2R9Ast__id_tN13K_form__dom_tLR9Ast__id_t,
      _fx_copy_T3N14K_form__kexp_tLT2R9Ast__id_tN13K_form__dom_tLR9Ast__id_t);
}

static void
   _fx_free_T4LT3N14K_form__kexp_tLT2R9Ast__id_tN13K_form__dom_tLR9Ast__id_tN14K_form__kexp_tR16Ast__for_flags_tT2N14K_form__ktyp_tR10Ast__loc_t(
   struct _fx_T4LT3N14K_form__kexp_tLT2R9Ast__id_tN13K_form__dom_tLR9Ast__id_tN14K_form__kexp_tR16Ast__for_flags_tT2N14K_form__ktyp_tR10Ast__loc_t*
      dst)
{
   _fx_free_LT3N14K_form__kexp_tLT2R9Ast__id_tN13K_form__dom_tLR9Ast__id_t(&dst->t0);
   _fx_free_N14K_form__kexp_t(&dst->t1);
   _fx_free_T2N14K_form__ktyp_tR10Ast__loc_t(&dst->t3);
}

static void
   _fx_copy_T4LT3N14K_form__kexp_tLT2R9Ast__id_tN13K_form__dom_tLR9Ast__id_tN14K_form__kexp_tR16Ast__for_flags_tT2N14K_form__ktyp_tR10Ast__loc_t(
   struct _fx_T4LT3N14K_form__kexp_tLT2R9Ast__id_tN13K_form__dom_tLR9Ast__id_tN14K_form__kexp_tR16Ast__for_flags_tT2N14K_form__ktyp_tR10Ast__loc_t*
      src,
   struct _fx_T4LT3N14K_form__kexp_tLT2R9Ast__id_tN13K_form__dom_tLR9Ast__id_tN14K_form__kexp_tR16Ast__for_flags_tT2N14K_form__ktyp_tR10Ast__loc_t*
      dst)
{
   FX_COPY_PTR(src->t0, &dst->t0);
   FX_COPY_PTR(src->t1, &dst->t1);
   dst->t2 = src->t2;
   _fx_copy_T2N14K_form__ktyp_tR10Ast__loc_t(&src->t3, &dst->t3);
}

static void
   _fx_make_T4LT3N14K_form__kexp_tLT2R9Ast__id_tN13K_form__dom_tLR9Ast__id_tN14K_form__kexp_tR16Ast__for_flags_tT2N14K_form__ktyp_tR10Ast__loc_t(
   struct _fx_LT3N14K_form__kexp_tLT2R9Ast__id_tN13K_form__dom_tLR9Ast__id_t_data_t* t0,
   struct _fx_N14K_form__kexp_t_data_t* t1,
   struct _fx_R16Ast__for_flags_t* t2,
   struct _fx_T2N14K_form__ktyp_tR10Ast__loc_t* t3,
   struct _fx_T4LT3N14K_form__kexp_tLT2R9Ast__id_tN13K_form__dom_tLR9Ast__id_tN14K_form__kexp_tR16Ast__for_flags_tT2N14K_form__ktyp_tR10Ast__loc_t*
      fx_result)
{
   FX_COPY_PTR(t0, &fx_result->t0);
   FX_COPY_PTR(t1, &fx_result->t1);
   fx_result->t2 = *t2;
   _fx_copy_T2N14K_form__ktyp_tR10Ast__loc_t(t3, &fx_result->t3);
}

static void _fx_free_T5LT2R9Ast__id_tN13K_form__dom_tLR9Ast__id_tN14K_form__kexp_tR16Ast__for_flags_tR10Ast__loc_t(
   struct _fx_T5LT2R9Ast__id_tN13K_form__dom_tLR9Ast__id_tN14K_form__kexp_tR16Ast__for_flags_tR10Ast__loc_t* dst)
{
   _fx_free_LT2R9Ast__id_tN13K_form__dom_t(&dst->t0);
   fx_free_list_simple(&dst->t1);
   _fx_free_N14K_form__kexp_t(&dst->t2);
}

static void _fx_copy_T5LT2R9Ast__id_tN13K_form__dom_tLR9Ast__id_tN14K_form__kexp_tR16Ast__for_flags_tR10Ast__loc_t(
   struct _fx_T5LT2R9Ast__id_tN13K_form__dom_tLR9Ast__id_tN14K_form__kexp_tR16Ast__for_flags_tR10Ast__loc_t* src,
   struct _fx_T5LT2R9Ast__id_tN13K_form__dom_tLR9Ast__id_tN14K_form__kexp_tR16Ast__for_flags_tR10Ast__loc_t* dst)
{
   FX_COPY_PTR(src->t0, &dst->t0);
   FX_COPY_PTR(src->t1, &dst->t1);
   FX_COPY_PTR(src->t2, &dst->t2);
   dst->t3 = src->t3;
   dst->t4 = src->t4;
}

static void _fx_make_T5LT2R9Ast__id_tN13K_form__dom_tLR9Ast__id_tN14K_form__kexp_tR16Ast__for_flags_tR10Ast__loc_t(
   struct _fx_LT2R9Ast__id_tN13K_form__dom_t_data_t* t0,
   struct _fx_LR9Ast__id_t_data_t* t1,
   struct _fx_N14K_form__kexp_t_data_t* t2,
   struct _fx_R16Ast__for_flags_t* t3,
   struct _fx_R10Ast__loc_t* t4,
   struct _fx_T5LT2R9Ast__id_tN13K_form__dom_tLR9Ast__id_tN14K_form__kexp_tR16Ast__for_flags_tR10Ast__loc_t* fx_result)
{
   FX_COPY_PTR(t0, &fx_result->t0);
   FX_COPY_PTR(t1, &fx_result->t1);
   FX_COPY_PTR(t2, &fx_result->t2);
   fx_result->t3 = *t3;
   fx_result->t4 = *t4;
}

static void _fx_free_T3N14K_form__kexp_tN14K_form__kexp_tR10Ast__loc_t(
   struct _fx_T3N14K_form__kexp_tN14K_form__kexp_tR10Ast__loc_t* dst)
{
   _fx_free_N14K_form__kexp_t(&dst->t0);
   _fx_free_N14K_form__kexp_t(&dst->t1);
}

static void _fx_copy_T3N14K_form__kexp_tN14K_form__kexp_tR10Ast__loc_t(
   struct _fx_T3N14K_form__kexp_tN14K_form__kexp_tR10Ast__loc_t* src,
   struct _fx_T3N14K_form__kexp_tN14K_form__kexp_tR10Ast__loc_t* dst)
{
   FX_COPY_PTR(src->t0, &dst->t0);
   FX_COPY_PTR(src->t1, &dst->t1);
   dst->t2 = src->t2;
}

static void _fx_make_T3N14K_form__kexp_tN14K_form__kexp_tR10Ast__loc_t(
   struct _fx_N14K_form__kexp_t_data_t* t0,
   struct _fx_N14K_form__kexp_t_data_t* t1,
   struct _fx_R10Ast__loc_t* t2,
   struct _fx_T3N14K_form__kexp_tN14K_form__kexp_tR10Ast__loc_t* fx_result)
{
   FX_COPY_PTR(t0, &fx_result->t0);
   FX_COPY_PTR(t1, &fx_result->t1);
   fx_result->t2 = *t2;
}

static void _fx_free_T2ST2N14K_form__ktyp_tR10Ast__loc_t(struct _fx_T2ST2N14K_form__ktyp_tR10Ast__loc_t* dst)
{
   fx_free_str(&dst->t0);
   _fx_free_T2N14K_form__ktyp_tR10Ast__loc_t(&dst->t1);
}

static void _fx_copy_T2ST2N14K_form__ktyp_tR10Ast__loc_t(
   struct _fx_T2ST2N14K_form__ktyp_tR10Ast__loc_t* src,
   struct _fx_T2ST2N14K_form__ktyp_tR10Ast__loc_t* dst)
{
   fx_copy_str(&src->t0, &dst->t0);
   _fx_copy_T2N14K_form__ktyp_tR10Ast__loc_t(&src->t1, &dst->t1);
}

static void _fx_make_T2ST2N14K_form__ktyp_tR10Ast__loc_t(
   fx_str_t* t0,
   struct _fx_T2N14K_form__ktyp_tR10Ast__loc_t* t1,
   struct _fx_T2ST2N14K_form__ktyp_tR10Ast__loc_t* fx_result)
{
   fx_copy_str(t0, &fx_result->t0);
   _fx_copy_T2N14K_form__ktyp_tR10Ast__loc_t(t1, &fx_result->t1);
}

static void _fx_free_T3R9Ast__id_tN14K_form__kexp_tR10Ast__loc_t(struct _fx_T3R9Ast__id_tN14K_form__kexp_tR10Ast__loc_t* dst)
{
   _fx_free_N14K_form__kexp_t(&dst->t1);
}

static void _fx_copy_T3R9Ast__id_tN14K_form__kexp_tR10Ast__loc_t(
   struct _fx_T3R9Ast__id_tN14K_form__kexp_tR10Ast__loc_t* src,
   struct _fx_T3R9Ast__id_tN14K_form__kexp_tR10Ast__loc_t* dst)
{
   dst->t0 = src->t0;
   FX_COPY_PTR(src->t1, &dst->t1);
   dst->t2 = src->t2;
}

static void _fx_make_T3R9Ast__id_tN14K_form__kexp_tR10Ast__loc_t(
   struct _fx_R9Ast__id_t* t0,
   struct _fx_N14K_form__kexp_t_data_t* t1,
   struct _fx_R10Ast__loc_t* t2,
   struct _fx_T3R9Ast__id_tN14K_form__kexp_tR10Ast__loc_t* fx_result)
{
   fx_result->t0 = *t0;
   FX_COPY_PTR(t1, &fx_result->t1);
   fx_result->t2 = *t2;
}

static void _fx_free_N14K_form__kexp_t(struct _fx_N14K_form__kexp_t_data_t** dst)
{
   if (*dst && FX_DECREF((*dst)->rc) == 1) {
      switch ((*dst)->tag) {
      case 4:
         _fx_free_T2Nt6option1N14K_form__atom_tR10Ast__loc_t(&(*dst)->u.KExpReturn); break;
      case 5:
         _fx_free_T2N14K_form__atom_tT2N14K_form__ktyp_tR10Ast__loc_t(&(*dst)->u.KExpAtom); break;
      case 6:
         _fx_free_T4N13Ast__binary_tN14K_form__atom_tN14K_form__atom_tT2N14K_form__ktyp_tR10Ast__loc_t(&(*dst)->u.KExpBinary);
         break;
      case 7:
         _fx_free_T3N12Ast__unary_tN14K_form__atom_tT2N14K_form__ktyp_tR10Ast__loc_t(&(*dst)->u.KExpUnary); break;
      case 8:
         _fx_free_T3N13Ast__intrin_tLN14K_form__atom_tT2N14K_form__ktyp_tR10Ast__loc_t(&(*dst)->u.KExpIntrin); break;
      case 9:
         _fx_free_T2R9Ast__id_tN14K_form__kexp_t(&(*dst)->u.KExpSync); break;
      case 10:
         _fx_free_T2LN14K_form__kexp_tT2N14K_form__ktyp_tR10Ast__loc_t(&(*dst)->u.KExpSeq); break;
      case 11:
         _fx_free_T4N14K_form__kexp_tN14K_form__kexp_tN14K_form__kexp_tT2N14K_form__ktyp_tR10Ast__loc_t(&(*dst)->u.KExpIf);
         break;
      case 12:
         _fx_free_T3R9Ast__id_tLN14K_form__atom_tT2N14K_form__ktyp_tR10Ast__loc_t(&(*dst)->u.KExpCall); break;
      case 13:
         _fx_free_T4R9Ast__id_tiLN14K_form__atom_tT2N14K_form__ktyp_tR10Ast__loc_t(&(*dst)->u.KExpICall); break;
      case 14:
         _fx_free_T2LN14K_form__atom_tT2N14K_form__ktyp_tR10Ast__loc_t(&(*dst)->u.KExpMkTuple); break;
      case 15:
         _fx_free_T2LN14K_form__atom_tT2N14K_form__ktyp_tR10Ast__loc_t(&(*dst)->u.KExpMkRecord); break;
      case 16:
         _fx_free_T4R9Ast__id_tR9Ast__id_tLN14K_form__atom_tT2N14K_form__ktyp_tR10Ast__loc_t(&(*dst)->u.KExpMkClosure); break;
      case 17:
         _fx_free_T3BLLT2BN14K_form__atom_tT2N14K_form__ktyp_tR10Ast__loc_t(&(*dst)->u.KExpMkArray); break;
      case 18:
         _fx_free_T2LT2BN14K_form__atom_tT2N14K_form__ktyp_tR10Ast__loc_t(&(*dst)->u.KExpMkVector); break;
      case 19:
         _fx_free_T5N14K_form__atom_tN13Ast__border_tN18Ast__interpolate_tLN13K_form__dom_tT2N14K_form__ktyp_tR10Ast__loc_t(
            &(*dst)->u.KExpAt);
         break;
      case 20:
         _fx_free_T3R9Ast__id_tiT2N14K_form__ktyp_tR10Ast__loc_t(&(*dst)->u.KExpMem); break;
      case 21:
         _fx_free_T3R9Ast__id_tN14K_form__atom_tR10Ast__loc_t(&(*dst)->u.KExpAssign); break;
      case 22:
         _fx_free_T2LT2LN14K_form__kexp_tN14K_form__kexp_tT2N14K_form__ktyp_tR10Ast__loc_t(&(*dst)->u.KExpMatch); break;
      case 23:
         _fx_free_T3N14K_form__kexp_tN14K_form__kexp_tT2N14K_form__ktyp_tR10Ast__loc_t(&(*dst)->u.KExpTryCatch); break;
      case 25:
         _fx_free_T3N14K_form__atom_tN14K_form__ktyp_tR10Ast__loc_t(&(*dst)->u.KExpCast); break;
      case 26:
         _fx_free_T4LT3N14K_form__kexp_tLT2R9Ast__id_tN13K_form__dom_tLR9Ast__id_tN14K_form__kexp_tR16Ast__for_flags_tT2N14K_form__ktyp_tR10Ast__loc_t(
            &(*dst)->u.KExpMap);
         break;
      case 27:
         _fx_free_T5LT2R9Ast__id_tN13K_form__dom_tLR9Ast__id_tN14K_form__kexp_tR16Ast__for_flags_tR10Ast__loc_t(
            &(*dst)->u.KExpFor);
         break;
      case 28:
         _fx_free_T3N14K_form__kexp_tN14K_form__kexp_tR10Ast__loc_t(&(*dst)->u.KExpWhile); break;
      case 29:
         _fx_free_T3N14K_form__kexp_tN14K_form__kexp_tR10Ast__loc_t(&(*dst)->u.KExpDoWhile); break;
      case 30:
         _fx_free_T2ST2N14K_form__ktyp_tR10Ast__loc_t(&(*dst)->u.KExpCCode); break;
      case 31:
         _fx_free_T3R9Ast__id_tN14K_form__kexp_tR10Ast__loc_t(&(*dst)->u.KDefVal); break;
      case 32:
         _fx_free_rR17K_form__kdeffun_t(&(*dst)->u.KDefFun); break;
      case 33:
         _fx_free_rR17K_form__kdefexn_t(&(*dst)->u.KDefExn); break;
      case 34:
         _fx_free_rR21K_form__kdefvariant_t(&(*dst)->u.KDefVariant); break;
      case 35:
         _fx_free_rR23K_form__kdefinterface_t(&(*dst)->u.KDefInterface); break;
      case 36:
         _fx_free_rR17K_form__kdeftyp_t(&(*dst)->u.KDefTyp); break;
      case 37:
         _fx_free_rR25K_form__kdefclosurevars_t(&(*dst)->u.KDefClosureVars); break;
      default:
         ;
      }
      fx_free(*dst);
   }
   *dst = 0;
}

static void _fx_free_R14Ast__pragmas_t(struct _fx_R14Ast__pragmas_t* dst)
{
   _fx_free_LT2SR10Ast__loc_t(&dst->pragma_clibs);
}

static void _fx_copy_R14Ast__pragmas_t(struct _fx_R14Ast__pragmas_t* src, struct _fx_R14Ast__pragmas_t* dst)
{
   dst->pragma_cpp = src->pragma_cpp;
   FX_COPY_PTR(src->pragma_clibs, &dst->pragma_clibs);
}

static void _fx_make_R14Ast__pragmas_t(
   bool r_pragma_cpp,
   struct _fx_LT2SR10Ast__loc_t_data_t* r_pragma_clibs,
   struct _fx_R14Ast__pragmas_t* fx_result)
{
   fx_result->pragma_cpp = r_pragma_cpp;
   FX_COPY_PTR(r_pragma_clibs, &fx_result->pragma_clibs);
}

static void _fx_free_R17K_form__kmodule_t(struct _fx_R17K_form__kmodule_t* dst)
{
   fx_free_str(&dst->km_cname);
   _fx_free_LN14K_form__kexp_t(&dst->km_top);
   fx_free_list_simple(&dst->km_deps);
   _fx_free_R14Ast__pragmas_t(&dst->km_pragmas);
}

static void _fx_copy_R17K_form__kmodule_t(struct _fx_R17K_form__kmodule_t* src, struct _fx_R17K_form__kmodule_t* dst)
{
   dst->km_name = src->km_name;
   dst->km_idx = src->km_idx;
   dst->km_toposort_idx = src->km_toposort_idx;
   fx_copy_str(&src->km_cname, &dst->km_cname);
   FX_COPY_PTR(src->km_top, &dst->km_top);
   FX_COPY_PTR(src->km_deps, &dst->km_deps);
   dst->km_skip = src->km_skip;
   dst->km_main = src->km_main;
   _fx_copy_R14Ast__pragmas_t(&src->km_pragmas, &dst->km_pragmas);
}

static void _fx_make_R17K_form__kmodule_t(
   struct _fx_R9Ast__id_t* r_km_name,
   int_ r_km_idx,
   int_ r_km_toposort_idx,
   fx_str_t* r_km_cname,
   struct _fx_LN14K_form__kexp_t_data_t* r_km_top,
   struct _fx_Li_data_t* r_km_deps,
   bool r_km_skip,
   bool r_km_main,
   struct _fx_R14Ast__pragmas_t* r_km_pragmas,
   struct _fx_R17K_form__kmodule_t* fx_result)
{
   fx_result->km_name = *r_km_name;
   fx_result->km_idx = r_km_idx;
   fx_result->km_toposort_idx = r_km_toposort_idx;
   fx_copy_str(r_km_cname, &fx_result->km_cname);
   FX_COPY_PTR(r_km_top, &fx_result->km_top);
   FX_COPY_PTR(r_km_deps, &fx_result->km_deps);
   fx_result->km_skip = r_km_skip;
   fx_result->km_main = r_km_main;
   _fx_copy_R14Ast__pragmas_t(r_km_pragmas, &fx_result->km_pragmas);
}

static void _fx_free_LR17K_form__kmodule_t(struct _fx_LR17K_form__kmodule_t_data_t** dst)
{
   FX_FREE_LIST_IMPL(_fx_LR17K_form__kmodule_t, _fx_free_R17K_form__kmodule_t);
}

static int _fx_cons_LR17K_form__kmodule_t(
   struct _fx_R17K_form__kmodule_t* hd,
   struct _fx_LR17K_form__kmodule_t_data_t* tl,
   bool addref_tl,
   struct _fx_LR17K_form__kmodule_t_data_t** fx_result)
{
   FX_MAKE_LIST_IMPL(_fx_LR17K_form__kmodule_t, _fx_copy_R17K_form__kmodule_t);
}

static void _fx_free_Nt6option1LN12Ast__scope_t(struct _fx_Nt6option1LN12Ast__scope_t* dst)
{
   switch (dst->tag) {
   case 2:
      fx_free_list_simple(&dst->u.Some); break;
   default:
      ;
   }
   dst->tag = 0;
}

static void _fx_copy_Nt6option1LN12Ast__scope_t(
   struct _fx_Nt6option1LN12Ast__scope_t* src,
   struct _fx_Nt6option1LN12Ast__scope_t* dst)
{
   dst->tag = src->tag;
   switch (src->tag) {
   case 2:
      FX_COPY_PTR(src->u.Some, &dst->u.Some); break;
   default:
      dst->u = src->u;
   }
}

static void _fx_free_Rt20Hashmap__hashentry_t2SR9Ast__id_t(struct _fx_Rt20Hashmap__hashentry_t2SR9Ast__id_t* dst)
{
   fx_free_str(&dst->key);
}

static void _fx_copy_Rt20Hashmap__hashentry_t2SR9Ast__id_t(
   struct _fx_Rt20Hashmap__hashentry_t2SR9Ast__id_t* src,
   struct _fx_Rt20Hashmap__hashentry_t2SR9Ast__id_t* dst)
{
   dst->hv = src->hv;
   fx_copy_str(&src->key, &dst->key);
   dst->data = src->data;
}

static void _fx_make_Rt20Hashmap__hashentry_t2SR9Ast__id_t(
   uint64_t r_hv,
   fx_str_t* r_key,
   struct _fx_R9Ast__id_t* r_data,
   struct _fx_Rt20Hashmap__hashentry_t2SR9Ast__id_t* fx_result)
{
   fx_result->hv = r_hv;
   fx_copy_str(r_key, &fx_result->key);
   fx_result->data = *r_data;
}

static void _fx_free_T6Rt20Hashmap__hashentry_t2iiiiiA1iA1Rt20Hashmap__hashentry_t2ii(
   struct _fx_T6Rt20Hashmap__hashentry_t2iiiiiA1iA1Rt20Hashmap__hashentry_t2ii* dst)
{
   fx_free_arr(&dst->t4);
   fx_free_arr(&dst->t5);
}

static void _fx_copy_T6Rt20Hashmap__hashentry_t2iiiiiA1iA1Rt20Hashmap__hashentry_t2ii(
   struct _fx_T6Rt20Hashmap__hashentry_t2iiiiiA1iA1Rt20Hashmap__hashentry_t2ii* src,
   struct _fx_T6Rt20Hashmap__hashentry_t2iiiiiA1iA1Rt20Hashmap__hashentry_t2ii* dst)
{
   dst->t0 = src->t0;
   dst->t1 = src->t1;
   dst->t2 = src->t2;
   dst->t3 = src->t3;
   fx_copy_arr(&src->t4, &dst->t4);
   fx_copy_arr(&src->t5, &dst->t5);
}

static void _fx_make_T6Rt20Hashmap__hashentry_t2iiiiiA1iA1Rt20Hashmap__hashentry_t2ii(
   struct _fx_Rt20Hashmap__hashentry_t2ii* t0,
   int_ t1,
   int_ t2,
   int_ t3,
   fx_arr_t* t4,
   fx_arr_t* t5,
   struct _fx_T6Rt20Hashmap__hashentry_t2iiiiiA1iA1Rt20Hashmap__hashentry_t2ii* fx_result)
{
   fx_result->t0 = *t0;
   fx_result->t1 = t1;
   fx_result->t2 = t2;
   fx_result->t3 = t3;
   fx_copy_arr(t4, &fx_result->t4);
   fx_copy_arr(t5, &fx_result->t5);
}

static void _fx_free_Nt10Hashmap__t2ii(struct _fx_Nt10Hashmap__t2ii_data_t** dst)
{
   if (*dst && FX_DECREF((*dst)->rc) == 1) {
      _fx_free_T6Rt20Hashmap__hashentry_t2iiiiiA1iA1Rt20Hashmap__hashentry_t2ii(&(*dst)->u.t); fx_free(*dst);
   }
   *dst = 0;
}

static void _fx_free_T6Rt20Hashmap__hashentry_t2SR9Ast__id_tiiiA1iA1Rt20Hashmap__hashentry_t2SR9Ast__id_t(
   struct _fx_T6Rt20Hashmap__hashentry_t2SR9Ast__id_tiiiA1iA1Rt20Hashmap__hashentry_t2SR9Ast__id_t* dst)
{
   _fx_free_Rt20Hashmap__hashentry_t2SR9Ast__id_t(&dst->t0);
   fx_free_arr(&dst->t4);
   fx_free_arr(&dst->t5);
}

static void _fx_copy_T6Rt20Hashmap__hashentry_t2SR9Ast__id_tiiiA1iA1Rt20Hashmap__hashentry_t2SR9Ast__id_t(
   struct _fx_T6Rt20Hashmap__hashentry_t2SR9Ast__id_tiiiA1iA1Rt20Hashmap__hashentry_t2SR9Ast__id_t* src,
   struct _fx_T6Rt20Hashmap__hashentry_t2SR9Ast__id_tiiiA1iA1Rt20Hashmap__hashentry_t2SR9Ast__id_t* dst)
{
   _fx_copy_Rt20Hashmap__hashentry_t2SR9Ast__id_t(&src->t0, &dst->t0);
   dst->t1 = src->t1;
   dst->t2 = src->t2;
   dst->t3 = src->t3;
   fx_copy_arr(&src->t4, &dst->t4);
   fx_copy_arr(&src->t5, &dst->t5);
}

static void _fx_make_T6Rt20Hashmap__hashentry_t2SR9Ast__id_tiiiA1iA1Rt20Hashmap__hashentry_t2SR9Ast__id_t(
   struct _fx_Rt20Hashmap__hashentry_t2SR9Ast__id_t* t0,
   int_ t1,
   int_ t2,
   int_ t3,
   fx_arr_t* t4,
   fx_arr_t* t5,
   struct _fx_T6Rt20Hashmap__hashentry_t2SR9Ast__id_tiiiA1iA1Rt20Hashmap__hashentry_t2SR9Ast__id_t* fx_result)
{
   _fx_copy_Rt20Hashmap__hashentry_t2SR9Ast__id_t(t0, &fx_result->t0);
   fx_result->t1 = t1;
   fx_result->t2 = t2;
   fx_result->t3 = t3;
   fx_copy_arr(t4, &fx_result->t4);
   fx_copy_arr(t5, &fx_result->t5);
}

static void _fx_free_Nt10Hashmap__t2SR9Ast__id_t(struct _fx_Nt10Hashmap__t2SR9Ast__id_t_data_t** dst)
{
   if (*dst && FX_DECREF((*dst)->rc) == 1) {
      _fx_free_T6Rt20Hashmap__hashentry_t2SR9Ast__id_tiiiA1iA1Rt20Hashmap__hashentry_t2SR9Ast__id_t(&(*dst)->u.t);
      fx_free(*dst);
   }
   *dst = 0;
}

static void _fx_free_Ta2S(struct _fx_Ta2S* dst)
{
   fx_free_str(&dst->t0);
   fx_free_str(&dst->t1);
}

static void _fx_copy_Ta2S(struct _fx_Ta2S* src, struct _fx_Ta2S* dst)
{
   fx_copy_str(&src->t0, &dst->t0);
   fx_copy_str(&src->t1, &dst->t1);
}

static void _fx_make_Ta2S(fx_str_t* t0, fx_str_t* t1, struct _fx_Ta2S* fx_result)
{
   fx_copy_str(t0, &fx_result->t0);
   fx_copy_str(t1, &fx_result->t1);
}

static void _fx_free_rLN14K_form__kexp_t(struct _fx_rLN14K_form__kexp_t_data_t** dst)
{
   FX_FREE_REF_IMPL(_fx_rLN14K_form__kexp_t, _fx_free_LN14K_form__kexp_t);
}

static int _fx_make_rLN14K_form__kexp_t(
   struct _fx_LN14K_form__kexp_t_data_t* arg,
   struct _fx_rLN14K_form__kexp_t_data_t** fx_result)
{
   FX_MAKE_REF_IMPL(_fx_rLN14K_form__kexp_t, FX_COPY_PTR);
}

static void _fx_free_rNt10Hashmap__t2ii(struct _fx_rNt10Hashmap__t2ii_data_t** dst)
{
   FX_FREE_REF_IMPL(_fx_rNt10Hashmap__t2ii, _fx_free_Nt10Hashmap__t2ii);
}

static int _fx_make_rNt10Hashmap__t2ii(
   struct _fx_Nt10Hashmap__t2ii_data_t* arg,
   struct _fx_rNt10Hashmap__t2ii_data_t** fx_result)
{
   FX_MAKE_REF_IMPL(_fx_rNt10Hashmap__t2ii, FX_COPY_PTR);
}

_fx_Nt6option1FPv3N14K_form__atom_tR10Ast__loc_tR22K_form__k_fold_callb_t _fx_g14K_mangle__None = 0;
_fx_Nt6option1FPN14K_form__atom_t3N14K_form__atom_tR10Ast__loc_tR17K_form__k_callb_t _fx_g16K_mangle__None1_ = 0;
_fx_Nt6option1R17K_form__ktprops_t _fx_g16K_mangle__None2_ = { 1 };
_fx_Nt6option1R9Ast__id_t _fx_g16K_mangle__None3_ = { 1 };
static _fx_N14K_form__ktyp_t_data_t KTypVoid_data_2 = { 1, 7 };
_fx_N14K_form__ktyp_t _fx_g18K_mangle__KTypVoid = &KTypVoid_data_2;
_fx_N15K_form__kinfo_t _fx_g15K_mangle__KNone = { 1 };
FX_EXTERN_C int _fx_M3AstFM6__eq__B2RM4id_tRM4id_t(
   struct _fx_R9Ast__id_t* a_0,
   struct _fx_R9Ast__id_t* b_0,
   bool* fx_result,
   void* fx_fv);

FX_EXTERN_C bool _fx_M8K_mangleFM8__same__B2LT2R9Ast__id_tN14K_form__ktyp_tLT2R9Ast__id_tN14K_form__ktyp_t(
   struct _fx_LT2R9Ast__id_tN14K_form__ktyp_t_data_t* a,
   struct _fx_LT2R9Ast__id_tN14K_form__ktyp_t_data_t* b,
   void* fx_fv);

FX_EXTERN_C int _fx_M8K_mangleFM6__eq__B2T2R9Ast__id_tN14K_form__ktyp_tT2R9Ast__id_tN14K_form__ktyp_t(
   struct _fx_T2R9Ast__id_tN14K_form__ktyp_t* a_0,
   struct _fx_T2R9Ast__id_tN14K_form__ktyp_t* b_0,
   bool* fx_result,
   void* fx_fv);

FX_EXTERN_C bool _fx_M8K_mangleFM8__same__B2LN14K_form__ktyp_tLN14K_form__ktyp_t(
   struct _fx_LN14K_form__ktyp_t_data_t* a,
   struct _fx_LN14K_form__ktyp_t_data_t* b,
   void* fx_fv);

FX_EXTERN_C int _fx_M8K_mangleFM15__eq_variants__B2N14K_form__ktyp_tN14K_form__ktyp_t(
   struct _fx_N14K_form__ktyp_t_data_t* a_0,
   struct _fx_N14K_form__ktyp_t_data_t* b_0,
   bool* fx_result,
   void* fx_fv);

FX_EXTERN_C int _fx_F4joinS2SLS(fx_str_t* sep_0, struct _fx_LS_data_t* strs_0, fx_str_t* fx_result, void* fx_fv);

FX_EXTERN_C int _fx_M7HashmapFM9makeindexA1i1i(int_ size_0, fx_arr_t* fx_result, void* fx_fv);

FX_EXTERN_C int _fx_F9make_FailE1S(fx_str_t* arg0, fx_exn_t* fx_result);

FX_EXTERN_C uint64_t _fx_F4hashq1S(fx_str_t* x, void* fx_fv);

FX_EXTERN_C bool _fx_F6__eq__B2SS(fx_str_t* a, fx_str_t* b, void* fx_fv);

FX_EXTERN_C int _fx_F6assertv1B(bool f_0, void* fx_fv);

FX_EXTERN_C int _fx_M6StringFM7replaceS3SSS(
   fx_str_t* s,
   fx_str_t* substr,
   fx_str_t* new_substr,
   fx_str_t* fx_result,
   void* fx_fv);

FX_EXTERN_C int _fx_M3AstFM15get_module_nameRM4id_t1i(int_ m_0, struct _fx_R9Ast__id_t* fx_result, void* fx_fv);

FX_EXTERN_C int _fx_M3AstFM2ppS1RM4id_t(struct _fx_R9Ast__id_t* i_0, fx_str_t* fx_result, void* fx_fv);

FX_EXTERN_C int _fx_M6K_formFM6kinfo_N15K_form__kinfo_t2R9Ast__id_tR10Ast__loc_t(
   struct _fx_R9Ast__id_t* n_0,
   struct _fx_R10Ast__loc_t* loc_0,
   struct _fx_N15K_form__kinfo_t* fx_result,
   void* fx_fv);

FX_EXTERN_C int _fx_M6K_formFM10get_kscopeLN12Ast__scope_t1N15K_form__kinfo_t(
   struct _fx_N15K_form__kinfo_t* info_0,
   struct _fx_LN12Ast__scope_t_data_t** fx_result,
   void* fx_fv);

FX_EXTERN_C bool _fx_M4CharFM7isdigitB1C(char_ c, void* fx_fv);

FX_EXTERN_C int_ _fx_M6StringFM10to_int_or_i3Sii(fx_str_t* a, int_ defval, int_ base, void* fx_fv);

FX_EXTERN_C int _fx_F6stringS1i(int_ a, fx_str_t* fx_result, void* fx_fv);

static int _fx_M8K_mangleFM12make_unique_Ta2S6iNt10Hashmap__t2SR9Ast__id_tR9Ast__id_tSSS(
   int_ idx_0,
   struct _fx_Nt10Hashmap__t2SR9Ast__id_t_data_t* mangle_map_0,
   struct _fx_R9Ast__id_t* n_id_0,
   fx_str_t* name_0,
   fx_str_t* prefix_0,
   fx_str_t* suffix_0,
   struct _fx_Ta2S* fx_result,
   void* fx_fv);

FX_EXTERN_C bool _fx_M6StringFM10startswithB2SS(fx_str_t* s, fx_str_t* prefix, void* fx_fv);

static int _fx_M8K_mangleFM12mangle_ktyp_LS4N14K_form__ktyp_tLSR10Ast__loc_tNt10Hashmap__t2SR9Ast__id_t(
   struct _fx_N14K_form__ktyp_t_data_t* t_0,
   struct _fx_LS_data_t* result_0,
   struct _fx_R10Ast__loc_t* loc_0,
   struct _fx_Nt10Hashmap__t2SR9Ast__id_t_data_t* mangle_map_0,
   struct _fx_LS_data_t** fx_result,
   void* fx_fv);

FX_EXTERN_C_VAL(struct _fx_R9Ast__id_t _fx_g9Ast__noid)
FX_EXTERN_C int _fx_M3AstFM11compile_errE2RM5loc_tS(
   struct _fx_R10Ast__loc_t* loc_0,
   fx_str_t* msg_0,
   fx_exn_t* fx_result,
   void* fx_fv);

FX_EXTERN_C int _fx_M6K_formFM8get_kvalRM9kdefval_t2R9Ast__id_tR10Ast__loc_t(
   struct _fx_R9Ast__id_t* n_0,
   struct _fx_R10Ast__loc_t* loc_0,
   struct _fx_R17K_form__kdefval_t* fx_result,
   void* fx_fv);

FX_EXTERN_C void _fx_M6K_formFM4KValN15K_form__kinfo_t1RM9kdefval_t(
   struct _fx_R17K_form__kdefval_t* arg0,
   struct _fx_N15K_form__kinfo_t* fx_result);

FX_EXTERN_C int _fx_M6K_formFM13set_idk_entryv2R9Ast__id_tN15K_form__kinfo_t(
   struct _fx_R9Ast__id_t* n_0,
   struct _fx_N15K_form__kinfo_t* info_0,
   void* fx_fv);

FX_EXTERN_C int _fx_M6K_formFM7idk2strS2R9Ast__id_tR10Ast__loc_t(
   struct _fx_R9Ast__id_t* n_0,
   struct _fx_R10Ast__loc_t* loc_0,
   fx_str_t* fx_result,
   void* fx_fv);

FX_EXTERN_C int
   _fx_M8K_mangleFM7make_fpFPN14K_form__ktyp_t3N14K_form__ktyp_tR10Ast__loc_tR17K_form__k_callb_t4rirLN14K_form__kexp_tBNt10Hashmap__t2SR9Ast__id_t(
   struct _fx_ri_data_t* arg0,
   struct _fx_rLN14K_form__kexp_t_data_t* arg1,
   bool arg2,
   struct _fx_Nt10Hashmap__t2SR9Ast__id_t_data_t* arg3,
   struct _fx_FPN14K_form__ktyp_t3N14K_form__ktyp_tR10Ast__loc_tR17K_form__k_callb_t* fx_result);

FX_EXTERN_C int
   _fx_M8K_mangleFM7make_fpFPN14K_form__ktyp_t7R9Ast__id_tR10Ast__loc_tR17K_form__k_callb_trirLN14K_form__kexp_tBNt10Hashmap__t2SR9Ast__id_t4rirLN14K_form__kexp_tBNt10Hashmap__t2SR9Ast__id_t(
   struct _fx_ri_data_t* arg0,
   struct _fx_rLN14K_form__kexp_t_data_t* arg1,
   bool arg2,
   struct _fx_Nt10Hashmap__t2SR9Ast__id_t_data_t* arg3,
   struct _fx_FPN14K_form__ktyp_t7R9Ast__id_tR10Ast__loc_tR17K_form__k_callb_trirLN14K_form__kexp_tBNt10Hashmap__t2SR9Ast__id_t*
      fx_result);

FX_EXTERN_C int
   _fx_M8K_mangleFM7make_fpFPN14K_form__kexp_t2N14K_form__kexp_tR17K_form__k_callb_t4rirLN14K_form__kexp_tBNt10Hashmap__t2SR9Ast__id_t(
   struct _fx_ri_data_t* arg0,
   struct _fx_rLN14K_form__kexp_t_data_t* arg1,
   bool arg2,
   struct _fx_Nt10Hashmap__t2SR9Ast__id_t_data_t* arg3,
   struct _fx_FPN14K_form__kexp_t2N14K_form__kexp_tR17K_form__k_callb_t* fx_result);

FX_EXTERN_C void _fx_M3AstFM8ScModuleN12Ast__scope_t1i(int_ arg0, struct _fx_N12Ast__scope_t* fx_result);

FX_EXTERN_C int _fx_M6K_formFM8KTypNameN14K_form__ktyp_t1R9Ast__id_t(
   struct _fx_R9Ast__id_t* arg0,
   struct _fx_N14K_form__ktyp_t_data_t** fx_result);

FX_EXTERN_C int _fx_M6K_formFM7gen_idkR9Ast__id_t2iS(
   int_ m_idx_0,
   fx_str_t* s_0,
   struct _fx_R9Ast__id_t* fx_result,
   void* fx_fv);

FX_EXTERN_C void _fx_M6K_formFM4KTypN15K_form__kinfo_t1rRM9kdeftyp_t(
   struct _fx_rR17K_form__kdeftyp_t_data_t* arg0,
   struct _fx_N15K_form__kinfo_t* fx_result);

FX_EXTERN_C int _fx_M6K_formFM7KDefTypN14K_form__kexp_t1rRM9kdeftyp_t(
   struct _fx_rR17K_form__kdeftyp_t_data_t* arg0,
   struct _fx_N14K_form__kexp_t_data_t** fx_result);

static int _fx_M8K_mangleFM18walk_ktyp_n_mangleN14K_form__ktyp_t3N14K_form__ktyp_tR10Ast__loc_tR17K_form__k_callb_t(
   struct _fx_N14K_form__ktyp_t_data_t* t_0,
   struct _fx_R10Ast__loc_t* loc_0,
   struct _fx_R17K_form__k_callb_t* callb_0,
   struct _fx_N14K_form__ktyp_t_data_t** fx_result,
   void* fx_fv);

FX_EXTERN_C int _fx_M6K_formFM9walk_ktypN14K_form__ktyp_t3N14K_form__ktyp_tR10Ast__loc_tRM9k_callb_t(
   struct _fx_N14K_form__ktyp_t_data_t* t_0,
   struct _fx_R10Ast__loc_t* loc_0,
   struct _fx_R17K_form__k_callb_t* callb_0,
   struct _fx_N14K_form__ktyp_t_data_t** fx_result,
   void* fx_fv);

static int
   _fx_M8K_mangleFM13mangle_id_typN14K_form__ktyp_t7R9Ast__id_tR10Ast__loc_tR17K_form__k_callb_trirLN14K_form__kexp_tBNt10Hashmap__t2SR9Ast__id_t(
   struct _fx_R9Ast__id_t* i_0,
   struct _fx_R10Ast__loc_t* loc_0,
   struct _fx_R17K_form__k_callb_t* callb_0,
   struct _fx_ri_data_t* curr_km_idx_ref_0,
   struct _fx_rLN14K_form__kexp_t_data_t* curr_top_code_ref_0,
   bool final_mode_0,
   struct _fx_Nt10Hashmap__t2SR9Ast__id_t_data_t* mangle_map_0,
   struct _fx_N14K_form__ktyp_t_data_t** fx_result,
   void* fx_fv);

FX_EXTERN_C int _fx_M6K_formFM13get_val_scopeLN12Ast__scope_t1R16Ast__val_flags_t(
   struct _fx_R16Ast__val_flags_t* flags_0,
   struct _fx_LN12Ast__scope_t_data_t** fx_result,
   void* fx_fv);

FX_EXTERN_C int _fx_M6K_formFM12get_idk_ktypN14K_form__ktyp_t2R9Ast__id_tR10Ast__loc_t(
   struct _fx_R9Ast__id_t* n_0,
   struct _fx_R10Ast__loc_t* loc_0,
   struct _fx_N14K_form__ktyp_t_data_t** fx_result,
   void* fx_fv);

static int
   _fx_M8K_mangleFM25mangle_ktyp_retain_recordN14K_form__ktyp_t7N14K_form__ktyp_tR10Ast__loc_tR17K_form__k_callb_trirLN14K_form__kexp_tBNt10Hashmap__t2SR9Ast__id_t(
   struct _fx_N14K_form__ktyp_t_data_t* t_0,
   struct _fx_R10Ast__loc_t* loc_0,
   struct _fx_R17K_form__k_callb_t* callb_0,
   struct _fx_ri_data_t* curr_km_idx_ref_0,
   struct _fx_rLN14K_form__kexp_t_data_t* curr_top_code_ref_0,
   bool final_mode_0,
   struct _fx_Nt10Hashmap__t2SR9Ast__id_t_data_t* mangle_map_0,
   struct _fx_N14K_form__ktyp_t_data_t** fx_result,
   void* fx_fv);

FX_EXTERN_C int _fx_M6K_formFM10KTypRecordN14K_form__ktyp_t2R9Ast__id_tLT2R9Ast__id_tN14K_form__ktyp_t(
   struct _fx_R9Ast__id_t* arg0,
   struct _fx_LT2R9Ast__id_tN14K_form__ktyp_t_data_t* arg1,
   struct _fx_N14K_form__ktyp_t_data_t** fx_result);

static int
   _fx_M8K_mangleFM12mangle_idomlv8LT2R9Ast__id_tN13K_form__dom_tLR9Ast__id_tR10Ast__loc_tR17K_form__k_callb_trirLN14K_form__kexp_tBNt10Hashmap__t2SR9Ast__id_t(
   struct _fx_LT2R9Ast__id_tN13K_form__dom_t_data_t* idoml_0,
   struct _fx_LR9Ast__id_t_data_t* at_ids_0,
   struct _fx_R10Ast__loc_t* loc_0,
   struct _fx_R17K_form__k_callb_t* callb_0,
   struct _fx_ri_data_t* curr_km_idx_ref_0,
   struct _fx_rLN14K_form__kexp_t_data_t* curr_top_code_ref_0,
   bool final_mode_0,
   struct _fx_Nt10Hashmap__t2SR9Ast__id_t_data_t* mangle_map_0,
   void* fx_fv);

static int _fx_M8K_mangleFM18walk_kexp_n_mangleN14K_form__kexp_t2N14K_form__kexp_tR17K_form__k_callb_t(
   struct _fx_N14K_form__kexp_t_data_t* e_0,
   struct _fx_R17K_form__k_callb_t* callb_0,
   struct _fx_N14K_form__kexp_t_data_t** fx_result,
   void* fx_fv);

FX_EXTERN_C int _fx_M6K_formFM7KDefValN14K_form__kexp_t3R9Ast__id_tN14K_form__kexp_tR10Ast__loc_t(
   struct _fx_R9Ast__id_t* arg0,
   struct _fx_N14K_form__kexp_t_data_t* arg1,
   struct _fx_R10Ast__loc_t* arg2,
   struct _fx_N14K_form__kexp_t_data_t** fx_result);

FX_EXTERN_C int _fx_M6K_formFM10get_kf_typN14K_form__ktyp_t3LR9Ast__id_tN14K_form__ktyp_tR10Ast__loc_t(
   struct _fx_LR9Ast__id_t_data_t* kf_params_0,
   struct _fx_N14K_form__ktyp_t_data_t* kf_rt_0,
   struct _fx_R10Ast__loc_t* loc_0,
   struct _fx_N14K_form__ktyp_t_data_t** fx_result,
   void* fx_fv);

FX_EXTERN_C int _fx_M6K_formFM10deref_ktypN14K_form__ktyp_t2N14K_form__ktyp_tR10Ast__loc_t(
   struct _fx_N14K_form__ktyp_t_data_t* kt_0,
   struct _fx_R10Ast__loc_t* loc_0,
   struct _fx_N14K_form__ktyp_t_data_t** fx_result,
   void* fx_fv);

FX_EXTERN_C int _fx_M6K_formFM9KTypTupleN14K_form__ktyp_t1LN14K_form__ktyp_t(
   struct _fx_LN14K_form__ktyp_t_data_t* arg0,
   struct _fx_N14K_form__ktyp_t_data_t** fx_result);

FX_EXTERN_C int _fx_M6K_formFM7KTypFunN14K_form__ktyp_t2LN14K_form__ktyp_tN14K_form__ktyp_t(
   struct _fx_LN14K_form__ktyp_t_data_t* arg0,
   struct _fx_N14K_form__ktyp_t_data_t* arg1,
   struct _fx_N14K_form__ktyp_t_data_t** fx_result);

FX_EXTERN_C int _fx_M6K_formFM9walk_kexpN14K_form__kexp_t2N14K_form__kexp_tRM9k_callb_t(
   struct _fx_N14K_form__kexp_t_data_t* e_0,
   struct _fx_R17K_form__k_callb_t* callb_0,
   struct _fx_N14K_form__kexp_t_data_t** fx_result,
   void* fx_fv);

FX_EXTERN_C int _fx_M6K_formFM9fold_kexpv2N14K_form__kexp_tRM14k_fold_callb_t(
   struct _fx_N14K_form__kexp_t_data_t* e_0,
   struct _fx_R22K_form__k_fold_callb_t* callb_0,
   void* fx_fv);

FX_EXTERN_C int _fx_M8K_mangleFM7make_fpFPv2N14K_form__kexp_tR22K_form__k_fold_callb_t2rNt10Hashmap__t2iirNt10Hashmap__t2ii(
   struct _fx_rNt10Hashmap__t2ii_data_t* arg0,
   struct _fx_rNt10Hashmap__t2ii_data_t* arg1,
   struct _fx_FPv2N14K_form__kexp_tR22K_form__k_fold_callb_t* fx_result);

static int _fx_M8K_mangleFM14gen_kval_cnamev4R9Ast__id_tR10Ast__loc_tBrNt10Hashmap__t2ii(
   struct _fx_R9Ast__id_t* n_0,
   struct _fx_R10Ast__loc_t* loc_0,
   bool global_0,
   struct _fx_rNt10Hashmap__t2ii_data_t* prefix_hash_ref_0,
   void* fx_fv);

FX_EXTERN_C_VAL(struct _fx_Nt9Dynvec__t1S_data_t* _fx_g14Ast__all_names)
FX_EXTERN_C int _fx_M3AstFM6get_idRM4id_t1S(fx_str_t* s_0, struct _fx_R9Ast__id_t* fx_result, void* fx_fv);

static int _fx_M8K_mangleFM12mangle_kexp_v2N14K_form__kexp_tR22K_form__k_fold_callb_t(
   struct _fx_N14K_form__kexp_t_data_t* e_0,
   struct _fx_R22K_form__k_fold_callb_t* callb_0,
   void* fx_fv);

typedef struct {
   int_ rc;
   fx_free_t free_f;
   struct _fx_ri_data_t* t0;
   struct _fx_rLN14K_form__kexp_t_data_t* t1;
   bool t2;
   struct _fx_Nt10Hashmap__t2SR9Ast__id_t_data_t* t3;
} _fx_M8K_mangleFM18walk_ktyp_n_mangleN14K_form__ktyp_t3N14K_form__ktyp_tR10Ast__loc_tR17K_form__k_callb_t_cldata_t;

FX_EXTERN_C void _fx_free_M8K_mangleFM18walk_ktyp_n_mangleN14K_form__ktyp_t3N14K_form__ktyp_tR10Ast__loc_tR17K_form__k_callb_t(
   _fx_M8K_mangleFM18walk_ktyp_n_mangleN14K_form__ktyp_t3N14K_form__ktyp_tR10Ast__loc_tR17K_form__k_callb_t_cldata_t* dst)
{
   FX_FREE_REF_SIMPLE(&dst->t0);
   _fx_free_rLN14K_form__kexp_t(&dst->t1);
   _fx_free_Nt10Hashmap__t2SR9Ast__id_t(&dst->t3);
   fx_free(dst);
}

typedef struct {
   int_ rc;
   fx_free_t free_f;
   struct _fx_ri_data_t* t0;
   struct _fx_rLN14K_form__kexp_t_data_t* t1;
   bool t2;
   struct _fx_Nt10Hashmap__t2SR9Ast__id_t_data_t* t3;
} _fx_M8K_mangleFM13mangle_id_typN14K_form__ktyp_t7R9Ast__id_tR10Ast__loc_tR17K_form__k_callb_trirLN14K_form__kexp_tBNt10Hashmap__t2SR9Ast__id_t_cldata_t;

FX_EXTERN_C void
   _fx_free_M8K_mangleFM13mangle_id_typN14K_form__ktyp_t7R9Ast__id_tR10Ast__loc_tR17K_form__k_callb_trirLN14K_form__kexp_tBNt10Hashmap__t2SR9Ast__id_t(
   _fx_M8K_mangleFM13mangle_id_typN14K_form__ktyp_t7R9Ast__id_tR10Ast__loc_tR17K_form__k_callb_trirLN14K_form__kexp_tBNt10Hashmap__t2SR9Ast__id_t_cldata_t*
      dst)
{
   FX_FREE_REF_SIMPLE(&dst->t0);
   _fx_free_rLN14K_form__kexp_t(&dst->t1);
   _fx_free_Nt10Hashmap__t2SR9Ast__id_t(&dst->t3);
   fx_free(dst);
}

typedef struct {
   int_ rc;
   fx_free_t free_f;
   struct _fx_ri_data_t* t0;
   struct _fx_rLN14K_form__kexp_t_data_t* t1;
   bool t2;
   struct _fx_Nt10Hashmap__t2SR9Ast__id_t_data_t* t3;
} _fx_M8K_mangleFM25mangle_ktyp_retain_recordN14K_form__ktyp_t7N14K_form__ktyp_tR10Ast__loc_tR17K_form__k_callb_trirLN14K_form__kexp_tBNt10Hashmap__t2SR9Ast__id_t_cldata_t;

FX_EXTERN_C void
   _fx_free_M8K_mangleFM25mangle_ktyp_retain_recordN14K_form__ktyp_t7N14K_form__ktyp_tR10Ast__loc_tR17K_form__k_callb_trirLN14K_form__kexp_tBNt10Hashmap__t2SR9Ast__id_t(
   _fx_M8K_mangleFM25mangle_ktyp_retain_recordN14K_form__ktyp_t7N14K_form__ktyp_tR10Ast__loc_tR17K_form__k_callb_trirLN14K_form__kexp_tBNt10Hashmap__t2SR9Ast__id_t_cldata_t*
      dst)
{
   FX_FREE_REF_SIMPLE(&dst->t0);
   _fx_free_rLN14K_form__kexp_t(&dst->t1);
   _fx_free_Nt10Hashmap__t2SR9Ast__id_t(&dst->t3);
   fx_free(dst);
}

typedef struct {
   int_ rc;
   fx_free_t free_f;
   struct _fx_ri_data_t* t0;
   struct _fx_rLN14K_form__kexp_t_data_t* t1;
   bool t2;
   struct _fx_Nt10Hashmap__t2SR9Ast__id_t_data_t* t3;
} _fx_M8K_mangleFM12mangle_idomlv8LT2R9Ast__id_tN13K_form__dom_tLR9Ast__id_tR10Ast__loc_tR17K_form__k_callb_trirLN14K_form__kexp_tBNt10Hashmap__t2SR9Ast__id_t_cldata_t;

FX_EXTERN_C void
   _fx_free_M8K_mangleFM12mangle_idomlv8LT2R9Ast__id_tN13K_form__dom_tLR9Ast__id_tR10Ast__loc_tR17K_form__k_callb_trirLN14K_form__kexp_tBNt10Hashmap__t2SR9Ast__id_t(
   _fx_M8K_mangleFM12mangle_idomlv8LT2R9Ast__id_tN13K_form__dom_tLR9Ast__id_tR10Ast__loc_tR17K_form__k_callb_trirLN14K_form__kexp_tBNt10Hashmap__t2SR9Ast__id_t_cldata_t*
      dst)
{
   FX_FREE_REF_SIMPLE(&dst->t0);
   _fx_free_rLN14K_form__kexp_t(&dst->t1);
   _fx_free_Nt10Hashmap__t2SR9Ast__id_t(&dst->t3);
   fx_free(dst);
}

typedef struct {
   int_ rc;
   fx_free_t free_f;
   struct _fx_ri_data_t* t0;
   struct _fx_rLN14K_form__kexp_t_data_t* t1;
   bool t2;
   struct _fx_Nt10Hashmap__t2SR9Ast__id_t_data_t* t3;
} _fx_M8K_mangleFM18walk_kexp_n_mangleN14K_form__kexp_t2N14K_form__kexp_tR17K_form__k_callb_t_cldata_t;

FX_EXTERN_C void _fx_free_M8K_mangleFM18walk_kexp_n_mangleN14K_form__kexp_t2N14K_form__kexp_tR17K_form__k_callb_t(
   _fx_M8K_mangleFM18walk_kexp_n_mangleN14K_form__kexp_t2N14K_form__kexp_tR17K_form__k_callb_t_cldata_t* dst)
{
   FX_FREE_REF_SIMPLE(&dst->t0);
   _fx_free_rLN14K_form__kexp_t(&dst->t1);
   _fx_free_Nt10Hashmap__t2SR9Ast__id_t(&dst->t3);
   fx_free(dst);
}

typedef struct {
   int_ rc;
   fx_free_t free_f;
   struct _fx_rNt10Hashmap__t2ii_data_t* t0;
   struct _fx_rNt10Hashmap__t2ii_data_t* t1;
} _fx_M8K_mangleFM12mangle_kexp_v2N14K_form__kexp_tR22K_form__k_fold_callb_t_cldata_t;

FX_EXTERN_C void _fx_free_M8K_mangleFM12mangle_kexp_v2N14K_form__kexp_tR22K_form__k_fold_callb_t(
   _fx_M8K_mangleFM12mangle_kexp_v2N14K_form__kexp_tR22K_form__k_fold_callb_t_cldata_t* dst)
{
   _fx_free_rNt10Hashmap__t2ii(&dst->t0);
   _fx_free_rNt10Hashmap__t2ii(&dst->t1);
   fx_free(dst);
}

FX_EXTERN_C void _fx_M8K_mangleFM4SomeNt6option1LN12Ast__scope_t1LN12Ast__scope_t(
   struct _fx_LN12Ast__scope_t_data_t* arg0,
   struct _fx_Nt6option1LN12Ast__scope_t* fx_result)
{
   fx_result->tag = 2;
   FX_COPY_PTR(arg0, &fx_result->u.Some);
}

FX_EXTERN_C int
   _fx_M8K_mangleFM4SomeNt6option1FPv2N14K_form__kexp_tR22K_form__k_fold_callb_t1FPv2N14K_form__kexp_tR22K_form__k_fold_callb_t(
   struct _fx_FPv2N14K_form__kexp_tR22K_form__k_fold_callb_t* arg0,
   struct _fx_Nt6option1FPv2N14K_form__kexp_tR22K_form__k_fold_callb_t_data_t** fx_result)
{
   FX_MAKE_RECURSIVE_VARIANT_IMPL_START(_fx_Nt6option1FPv2N14K_form__kexp_tR22K_form__k_fold_callb_t);
   FX_COPY_FP(arg0, &v->u.Some);
   return 0;
}

FX_EXTERN_C int
   _fx_M8K_mangleFM4SomeNt6option1FPv3N14K_form__ktyp_tR10Ast__loc_tR22K_form__k_fold_callb_t1FPv3N14K_form__ktyp_tR10Ast__loc_tR22K_form__k_fold_callb_t(
   struct _fx_FPv3N14K_form__ktyp_tR10Ast__loc_tR22K_form__k_fold_callb_t* arg0,
   struct _fx_Nt6option1FPv3N14K_form__ktyp_tR10Ast__loc_tR22K_form__k_fold_callb_t_data_t** fx_result)
{
   FX_MAKE_RECURSIVE_VARIANT_IMPL_START(_fx_Nt6option1FPv3N14K_form__ktyp_tR10Ast__loc_tR22K_form__k_fold_callb_t);
   FX_COPY_FP(arg0, &v->u.Some);
   return 0;
}

FX_EXTERN_C int
   _fx_M8K_mangleFM4SomeNt6option1FPN14K_form__kexp_t2N14K_form__kexp_tR17K_form__k_callb_t1FPN14K_form__kexp_t2N14K_form__kexp_tR17K_form__k_callb_t(
   struct _fx_FPN14K_form__kexp_t2N14K_form__kexp_tR17K_form__k_callb_t* arg0,
   struct _fx_Nt6option1FPN14K_form__kexp_t2N14K_form__kexp_tR17K_form__k_callb_t_data_t** fx_result)
{
   FX_MAKE_RECURSIVE_VARIANT_IMPL_START(_fx_Nt6option1FPN14K_form__kexp_t2N14K_form__kexp_tR17K_form__k_callb_t);
   FX_COPY_FP(arg0, &v->u.Some);
   return 0;
}

FX_EXTERN_C int
   _fx_M8K_mangleFM4SomeNt6option1FPN14K_form__ktyp_t3N14K_form__ktyp_tR10Ast__loc_tR17K_form__k_callb_t1FPN14K_form__ktyp_t3N14K_form__ktyp_tR10Ast__loc_tR17K_form__k_callb_t(
   struct _fx_FPN14K_form__ktyp_t3N14K_form__ktyp_tR10Ast__loc_tR17K_form__k_callb_t* arg0,
   struct _fx_Nt6option1FPN14K_form__ktyp_t3N14K_form__ktyp_tR10Ast__loc_tR17K_form__k_callb_t_data_t** fx_result)
{
   FX_MAKE_RECURSIVE_VARIANT_IMPL_START(_fx_Nt6option1FPN14K_form__ktyp_t3N14K_form__ktyp_tR10Ast__loc_tR17K_form__k_callb_t);
   FX_COPY_FP(arg0, &v->u.Some);
   return 0;
}

FX_EXTERN_C void _fx_M8K_mangleFM4SomeNt6option1R9Ast__id_t1R9Ast__id_t(
   struct _fx_R9Ast__id_t* arg0,
   struct _fx_Nt6option1R9Ast__id_t* fx_result)
{
   fx_result->tag = 2;
   fx_result->u.Some = *arg0;
}

FX_EXTERN_C int _fx_M8K_mangleFM6ignorev1N14K_form__ktyp_t(struct _fx_N14K_form__ktyp_t_data_t* __0, void* fx_fv)
{
   int fx_status = 0;
   return fx_status;
}

FX_EXTERN_C int _fx_M8K_mangleFM6__ne__B2R9Ast__id_tR9Ast__id_t(
   struct _fx_R9Ast__id_t* a_0,
   struct _fx_R9Ast__id_t* b_0,
   bool* fx_result,
   void* fx_fv)
{
   int fx_status = 0;
   bool res_0;
   FX_CALL(_fx_M3AstFM6__eq__B2RM4id_tRM4id_t(a_0, b_0, &res_0, 0), _fx_cleanup);
   *fx_result = !res_0;

_fx_cleanup: ;
   return fx_status;
}

FX_EXTERN_C int_ _fx_M8K_mangleFM6lengthi1LN14K_form__ktyp_t(struct _fx_LN14K_form__ktyp_t_data_t* l, void* fx_fv)
{
   
return fx_list_length(l);

}

FX_EXTERN_C int _fx_M8K_mangleFM6stringS1S(fx_str_t* a_0, fx_str_t* fx_result, void* fx_fv)
{
   int fx_status = 0;
   fx_copy_str(a_0, fx_result);
   return fx_status;
}

FX_EXTERN_C int _fx_M8K_mangleFM6__eq__B2LT2R9Ast__id_tN14K_form__ktyp_tLT2R9Ast__id_tN14K_form__ktyp_t(
   struct _fx_LT2R9Ast__id_tN14K_form__ktyp_t_data_t* a_0,
   struct _fx_LT2R9Ast__id_tN14K_form__ktyp_t_data_t* b_0,
   bool* fx_result,
   void* fx_fv)
{
   _fx_LT2R9Ast__id_tN14K_form__ktyp_t a_1 = 0;
   _fx_LT2R9Ast__id_tN14K_form__ktyp_t b_1 = 0;
   int fx_status = 0;
   FX_CALL(fx_check_stack(), _fx_cleanup);
   bool result_0 = 0;
   FX_COPY_PTR(a_0, &a_1);
   FX_COPY_PTR(b_0, &b_1);
   for (;;) {
      _fx_LT2R9Ast__id_tN14K_form__ktyp_t a_2 = 0;
      _fx_LT2R9Ast__id_tN14K_form__ktyp_t b_2 = 0;
      FX_COPY_PTR(a_1, &a_2);
      FX_COPY_PTR(b_1, &b_2);
      if (_fx_M8K_mangleFM8__same__B2LT2R9Ast__id_tN14K_form__ktyp_tLT2R9Ast__id_tN14K_form__ktyp_t(a_2, b_2, 0)) {
         result_0 = true; FX_BREAK(_fx_catch_3);
      }
      else {
         if (b_2 != 0) {
            if (a_2 != 0) {
               bool res_0;
               FX_CALL(
                  _fx_M8K_mangleFM6__eq__B2T2R9Ast__id_tN14K_form__ktyp_tT2R9Ast__id_tN14K_form__ktyp_t(&a_2->hd, &b_2->hd,
                     &res_0, 0), _fx_catch_0);
               if (res_0) {
                  _fx_LT2R9Ast__id_tN14K_form__ktyp_t* a_3 = &a_2->tl;
                  _fx_free_LT2R9Ast__id_tN14K_form__ktyp_t(&a_1);
                  FX_COPY_PTR(*a_3, &a_1);
                  _fx_LT2R9Ast__id_tN14K_form__ktyp_t* b_3 = &b_2->tl;
                  _fx_free_LT2R9Ast__id_tN14K_form__ktyp_t(&b_1);
                  FX_COPY_PTR(*b_3, &b_1);
               }
               else {
                  result_0 = false; FX_BREAK(_fx_catch_0);
               }

            _fx_catch_0: ;
               goto _fx_endmatch_0;
            }
         }
         if (b_2 == 0) {
            if (a_2 == 0) {
               result_0 = true; FX_BREAK(_fx_catch_1);  _fx_catch_1: ; goto _fx_endmatch_0;
            }
         }
         result_0 = false;
         FX_BREAK(_fx_catch_2);

      _fx_catch_2: ;

      _fx_endmatch_0: ;
         FX_CHECK_EXN(_fx_catch_3);
      }

   _fx_catch_3: ;
      if (b_2) {
         _fx_free_LT2R9Ast__id_tN14K_form__ktyp_t(&b_2);
      }
      if (a_2) {
         _fx_free_LT2R9Ast__id_tN14K_form__ktyp_t(&a_2);
      }
      FX_CHECK_BREAK();
      FX_CHECK_EXN(_fx_cleanup);
   }
   *fx_result = result_0;

_fx_cleanup: ;
   if (a_1) {
      _fx_free_LT2R9Ast__id_tN14K_form__ktyp_t(&a_1);
   }
   if (b_1) {
      _fx_free_LT2R9Ast__id_tN14K_form__ktyp_t(&b_1);
   }
   return fx_status;
}

FX_EXTERN_C int _fx_M8K_mangleFM6__eq__B2LN14K_form__ktyp_tLN14K_form__ktyp_t(
   struct _fx_LN14K_form__ktyp_t_data_t* a_0,
   struct _fx_LN14K_form__ktyp_t_data_t* b_0,
   bool* fx_result,
   void* fx_fv)
{
   _fx_LN14K_form__ktyp_t a_1 = 0;
   _fx_LN14K_form__ktyp_t b_1 = 0;
   int fx_status = 0;
   FX_CALL(fx_check_stack(), _fx_cleanup);
   bool result_0 = 0;
   FX_COPY_PTR(a_0, &a_1);
   FX_COPY_PTR(b_0, &b_1);
   for (;;) {
      _fx_LN14K_form__ktyp_t a_2 = 0;
      _fx_LN14K_form__ktyp_t b_2 = 0;
      FX_COPY_PTR(a_1, &a_2);
      FX_COPY_PTR(b_1, &b_2);
      if (_fx_M8K_mangleFM8__same__B2LN14K_form__ktyp_tLN14K_form__ktyp_t(a_2, b_2, 0)) {
         result_0 = true; FX_BREAK(_fx_catch_3);
      }
      else {
         if (b_2 != 0) {
            if (a_2 != 0) {
               bool res_0;
               FX_CALL(_fx_M8K_mangleFM15__eq_variants__B2N14K_form__ktyp_tN14K_form__ktyp_t(a_2->hd, b_2->hd, &res_0, 0),
                  _fx_catch_0);
               if (res_0) {
                  _fx_LN14K_form__ktyp_t* a_3 = &a_2->tl;
                  _fx_free_LN14K_form__ktyp_t(&a_1);
                  FX_COPY_PTR(*a_3, &a_1);
                  _fx_LN14K_form__ktyp_t* b_3 = &b_2->tl;
                  _fx_free_LN14K_form__ktyp_t(&b_1);
                  FX_COPY_PTR(*b_3, &b_1);
               }
               else {
                  result_0 = false; FX_BREAK(_fx_catch_0);
               }

            _fx_catch_0: ;
               goto _fx_endmatch_0;
            }
         }
         if (b_2 == 0) {
            if (a_2 == 0) {
               result_0 = true; FX_BREAK(_fx_catch_1);  _fx_catch_1: ; goto _fx_endmatch_0;
            }
         }
         result_0 = false;
         FX_BREAK(_fx_catch_2);

      _fx_catch_2: ;

      _fx_endmatch_0: ;
         FX_CHECK_EXN(_fx_catch_3);
      }

   _fx_catch_3: ;
      if (b_2) {
         _fx_free_LN14K_form__ktyp_t(&b_2);
      }
      if (a_2) {
         _fx_free_LN14K_form__ktyp_t(&a_2);
      }
      FX_CHECK_BREAK();
      FX_CHECK_EXN(_fx_cleanup);
   }
   *fx_result = result_0;

_fx_cleanup: ;
   if (a_1) {
      _fx_free_LN14K_form__ktyp_t(&a_1);
   }
   if (b_1) {
      _fx_free_LN14K_form__ktyp_t(&b_1);
   }
   return fx_status;
}

FX_EXTERN_C int _fx_M8K_mangleFM6__eq__B2T2R9Ast__id_tN14K_form__ktyp_tT2R9Ast__id_tN14K_form__ktyp_t(
   struct _fx_T2R9Ast__id_tN14K_form__ktyp_t* a_0,
   struct _fx_T2R9Ast__id_tN14K_form__ktyp_t* b_0,
   bool* fx_result,
   void* fx_fv)
{
   _fx_N14K_form__ktyp_t aj_0 = 0;
   _fx_N14K_form__ktyp_t bj_0 = 0;
   int fx_status = 0;
   FX_CALL(fx_check_stack(), _fx_cleanup);
   bool __fold_result___0 = true;
   _fx_R9Ast__id_t aj_1 = a_0->t0;
   _fx_R9Ast__id_t bj_1 = b_0->t0;
   bool res_0;
   FX_CALL(_fx_M3AstFM6__eq__B2RM4id_tRM4id_t(&aj_1, &bj_1, &res_0, 0), _fx_cleanup);
   bool t_0;
   if (res_0) {
      t_0 = __fold_result___0;
   }
   else {
      t_0 = false;
   }
   __fold_result___0 = t_0;
   FX_COPY_PTR(a_0->t1, &aj_0);
   FX_COPY_PTR(b_0->t1, &bj_0);
   bool v_0;
   FX_CALL(_fx_M8K_mangleFM15__eq_variants__B2N14K_form__ktyp_tN14K_form__ktyp_t(aj_0, bj_0, &v_0, 0), _fx_cleanup);
   bool t_1;
   if (v_0) {
      t_1 = __fold_result___0;
   }
   else {
      t_1 = false;
   }
   __fold_result___0 = t_1;
   *fx_result = __fold_result___0;

_fx_cleanup: ;
   if (aj_0) {
      _fx_free_N14K_form__ktyp_t(&aj_0);
   }
   if (bj_0) {
      _fx_free_N14K_form__ktyp_t(&bj_0);
   }
   return fx_status;
}

FX_EXTERN_C int _fx_M8K_mangleFM15__eq_variants__B2N14K_form__ktyp_tN14K_form__ktyp_t(
   struct _fx_N14K_form__ktyp_t_data_t* a_0,
   struct _fx_N14K_form__ktyp_t_data_t* b_0,
   bool* fx_result,
   void* fx_fv)
{
   _fx_N14K_form__ktyp_t a_1 = 0;
   _fx_N14K_form__ktyp_t b_1 = 0;
   int fx_status = 0;
   FX_CALL(fx_check_stack(), _fx_cleanup);
   bool result_0 = 0;
   FX_COPY_PTR(a_0, &a_1);
   FX_COPY_PTR(b_0, &b_1);
   for (;;) {
      _fx_N14K_form__ktyp_t a_2 = 0;
      _fx_N14K_form__ktyp_t b_2 = 0;
      FX_COPY_PTR(a_1, &a_2);
      FX_COPY_PTR(b_1, &b_2);
      if (FX_REC_VARIANT_TAG(b_2) == 3) {
         if (FX_REC_VARIANT_TAG(a_2) == 3) {
            result_0 = a_2->u.KTypSInt == b_2->u.KTypSInt; FX_BREAK(_fx_catch_0);  _fx_catch_0: ; goto _fx_endmatch_0;
         }
      }
      if (FX_REC_VARIANT_TAG(b_2) == 4) {
         if (FX_REC_VARIANT_TAG(a_2) == 4) {
            result_0 = a_2->u.KTypUInt == b_2->u.KTypUInt; FX_BREAK(_fx_catch_1);  _fx_catch_1: ; goto _fx_endmatch_0;
         }
      }
      if (FX_REC_VARIANT_TAG(b_2) == 5) {
         if (FX_REC_VARIANT_TAG(a_2) == 5) {
            result_0 = a_2->u.KTypFloat == b_2->u.KTypFloat; FX_BREAK(_fx_catch_2);  _fx_catch_2: ; goto _fx_endmatch_0;
         }
      }
      if (FX_REC_VARIANT_TAG(b_2) == 12) {
         if (FX_REC_VARIANT_TAG(a_2) == 12) {
            _fx_N14K_form__ktyp_t* a0_0 = &a_2->u.KTypRawPointer;
            _fx_free_N14K_form__ktyp_t(&a_1);
            FX_COPY_PTR(*a0_0, &a_1);
            _fx_N14K_form__ktyp_t* b0_0 = &b_2->u.KTypRawPointer;
            _fx_free_N14K_form__ktyp_t(&b_1);
            FX_COPY_PTR(*b0_0, &b_1);
            goto _fx_endmatch_0;
         }
      }
      if (FX_REC_VARIANT_TAG(b_2) == 13) {
         _fx_T2LN14K_form__ktyp_tN14K_form__ktyp_t* vcase_0 = &b_2->u.KTypFun;
         if (FX_REC_VARIANT_TAG(a_2) == 13) {
            _fx_T2LN14K_form__ktyp_tN14K_form__ktyp_t* vcase_1 = &a_2->u.KTypFun;
            bool v_0;
            FX_CALL(_fx_M8K_mangleFM6__eq__B2LN14K_form__ktyp_tLN14K_form__ktyp_t(vcase_1->t0, vcase_0->t0, &v_0, 0),
               _fx_catch_3);
            bool v_1;
            FX_CALL(_fx_M8K_mangleFM15__eq_variants__B2N14K_form__ktyp_tN14K_form__ktyp_t(vcase_1->t1, vcase_0->t1, &v_1, 0),
               _fx_catch_3);
            result_0 = (bool)(v_0 & v_1);
            FX_BREAK(_fx_catch_3);

         _fx_catch_3: ;
            goto _fx_endmatch_0;
         }
      }
      if (FX_REC_VARIANT_TAG(b_2) == 14) {
         if (FX_REC_VARIANT_TAG(a_2) == 14) {
            bool result_1;
            FX_CALL(
               _fx_M8K_mangleFM6__eq__B2LN14K_form__ktyp_tLN14K_form__ktyp_t(a_2->u.KTypTuple, b_2->u.KTypTuple, &result_1, 0),
               _fx_catch_4);
            result_0 = result_1;
            FX_BREAK(_fx_catch_4);

         _fx_catch_4: ;
            goto _fx_endmatch_0;
         }
      }
      if (FX_REC_VARIANT_TAG(b_2) == 15) {
         _fx_T2R9Ast__id_tLT2R9Ast__id_tN14K_form__ktyp_t* vcase_2 = &b_2->u.KTypRecord;
         if (FX_REC_VARIANT_TAG(a_2) == 15) {
            _fx_T2R9Ast__id_tLT2R9Ast__id_tN14K_form__ktyp_t* vcase_3 = &a_2->u.KTypRecord;
            bool res_0;
            FX_CALL(_fx_M3AstFM6__eq__B2RM4id_tRM4id_t(&vcase_3->t0, &vcase_2->t0, &res_0, 0), _fx_catch_5);
            bool v_2;
            FX_CALL(
               _fx_M8K_mangleFM6__eq__B2LT2R9Ast__id_tN14K_form__ktyp_tLT2R9Ast__id_tN14K_form__ktyp_t(vcase_3->t1, vcase_2->t1,
                  &v_2, 0), _fx_catch_5);
            result_0 = (bool)(res_0 & v_2);
            FX_BREAK(_fx_catch_5);

         _fx_catch_5: ;
            goto _fx_endmatch_0;
         }
      }
      if (FX_REC_VARIANT_TAG(b_2) == 16) {
         if (FX_REC_VARIANT_TAG(a_2) == 16) {
            bool res_1;
            FX_CALL(_fx_M3AstFM6__eq__B2RM4id_tRM4id_t(&a_2->u.KTypName, &b_2->u.KTypName, &res_1, 0), _fx_catch_6);
            result_0 = res_1;
            FX_BREAK(_fx_catch_6);

         _fx_catch_6: ;
            goto _fx_endmatch_0;
         }
      }
      if (FX_REC_VARIANT_TAG(b_2) == 17) {
         _fx_T2iN14K_form__ktyp_t* vcase_4 = &b_2->u.KTypArray;
         if (FX_REC_VARIANT_TAG(a_2) == 17) {
            _fx_T2iN14K_form__ktyp_t* vcase_5 = &a_2->u.KTypArray;
            bool v_3;
            FX_CALL(_fx_M8K_mangleFM15__eq_variants__B2N14K_form__ktyp_tN14K_form__ktyp_t(vcase_5->t1, vcase_4->t1, &v_3, 0),
               _fx_catch_7);
            result_0 = (bool)((vcase_5->t0 == vcase_4->t0) & v_3);
            FX_BREAK(_fx_catch_7);

         _fx_catch_7: ;
            goto _fx_endmatch_0;
         }
      }
      if (FX_REC_VARIANT_TAG(b_2) == 18) {
         if (FX_REC_VARIANT_TAG(a_2) == 18) {
            _fx_N14K_form__ktyp_t* a0_1 = &a_2->u.KTypVector;
            _fx_free_N14K_form__ktyp_t(&a_1);
            FX_COPY_PTR(*a0_1, &a_1);
            _fx_N14K_form__ktyp_t* b0_1 = &b_2->u.KTypVector;
            _fx_free_N14K_form__ktyp_t(&b_1);
            FX_COPY_PTR(*b0_1, &b_1);
            goto _fx_endmatch_0;
         }
      }
      if (FX_REC_VARIANT_TAG(b_2) == 19) {
         if (FX_REC_VARIANT_TAG(a_2) == 19) {
            _fx_N14K_form__ktyp_t* a0_2 = &a_2->u.KTypList;
            _fx_free_N14K_form__ktyp_t(&a_1);
            FX_COPY_PTR(*a0_2, &a_1);
            _fx_N14K_form__ktyp_t* b0_2 = &b_2->u.KTypList;
            _fx_free_N14K_form__ktyp_t(&b_1);
            FX_COPY_PTR(*b0_2, &b_1);
            goto _fx_endmatch_0;
         }
      }
      if (FX_REC_VARIANT_TAG(b_2) == 20) {
         if (FX_REC_VARIANT_TAG(a_2) == 20) {
            _fx_N14K_form__ktyp_t* a0_3 = &a_2->u.KTypRef;
            _fx_free_N14K_form__ktyp_t(&a_1);
            FX_COPY_PTR(*a0_3, &a_1);
            _fx_N14K_form__ktyp_t* b0_3 = &b_2->u.KTypRef;
            _fx_free_N14K_form__ktyp_t(&b_1);
            FX_COPY_PTR(*b0_3, &b_1);
            goto _fx_endmatch_0;
         }
      }
      result_0 = FX_REC_VARIANT_TAG(a_2) == FX_REC_VARIANT_TAG(b_2);
      FX_BREAK(_fx_catch_8);

   _fx_catch_8: ;

   _fx_endmatch_0: ;
      FX_CHECK_EXN(_fx_catch_9);

   _fx_catch_9: ;
      if (b_2) {
         _fx_free_N14K_form__ktyp_t(&b_2);
      }
      if (a_2) {
         _fx_free_N14K_form__ktyp_t(&a_2);
      }
      FX_CHECK_BREAK();
      FX_CHECK_EXN(_fx_cleanup);
   }
   *fx_result = result_0;

_fx_cleanup: ;
   if (a_1) {
      _fx_free_N14K_form__ktyp_t(&a_1);
   }
   if (b_1) {
      _fx_free_N14K_form__ktyp_t(&b_1);
   }
   return fx_status;
}

FX_EXTERN_C bool _fx_M8K_mangleFM8__same__B2LT2R9Ast__id_tN14K_form__ktyp_tLT2R9Ast__id_tN14K_form__ktyp_t(
   struct _fx_LT2R9Ast__id_tN14K_form__ktyp_t_data_t* a,
   struct _fx_LT2R9Ast__id_tN14K_form__ktyp_t_data_t* b,
   void* fx_fv)
{
   
return a == b;

}

FX_EXTERN_C bool _fx_M8K_mangleFM8__same__B2LN14K_form__ktyp_tLN14K_form__ktyp_t(
   struct _fx_LN14K_form__ktyp_t_data_t* a,
   struct _fx_LN14K_form__ktyp_t_data_t* b,
   void* fx_fv)
{
   
return a == b;

}

FX_EXTERN_C int _fx_M8K_mangleFM3revLN14K_form__kexp_t1LN14K_form__kexp_t(
   struct _fx_LN14K_form__kexp_t_data_t* l_0,
   struct _fx_LN14K_form__kexp_t_data_t** fx_result,
   void* fx_fv)
{
   _fx_LN14K_form__kexp_t __fold_result___0 = 0;
   int fx_status = 0;
   _fx_LN14K_form__kexp_t lst_0 = l_0;
   for (; lst_0; lst_0 = lst_0->tl) {
      _fx_LN14K_form__kexp_t r_0 = 0;
      _fx_N14K_form__kexp_t a_0 = lst_0->hd;
      FX_COPY_PTR(__fold_result___0, &r_0);
      FX_CALL(_fx_cons_LN14K_form__kexp_t(a_0, r_0, false, &r_0), _fx_catch_0);
      _fx_free_LN14K_form__kexp_t(&__fold_result___0);
      FX_COPY_PTR(r_0, &__fold_result___0);

   _fx_catch_0: ;
      if (r_0) {
         _fx_free_LN14K_form__kexp_t(&r_0);
      }
      FX_CHECK_EXN(_fx_cleanup);
   }
   FX_COPY_PTR(__fold_result___0, fx_result);

_fx_cleanup: ;
   if (__fold_result___0) {
      _fx_free_LN14K_form__kexp_t(&__fold_result___0);
   }
   return fx_status;
}

FX_EXTERN_C int _fx_M8K_mangleFM3revLS1LS(struct _fx_LS_data_t* l_0, struct _fx_LS_data_t** fx_result, void* fx_fv)
{
   _fx_LS __fold_result___0 = 0;
   int fx_status = 0;
   _fx_LS lst_0 = l_0;
   for (; lst_0; lst_0 = lst_0->tl) {
      _fx_LS r_0 = 0;
      fx_str_t* a_0 = &lst_0->hd;
      FX_COPY_PTR(__fold_result___0, &r_0);
      FX_CALL(_fx_cons_LS(a_0, r_0, false, &r_0), _fx_catch_0);
      _fx_free_LS(&__fold_result___0);
      FX_COPY_PTR(r_0, &__fold_result___0);

   _fx_catch_0: ;
      if (r_0) {
         _fx_free_LS(&r_0);
      }
      FX_CHECK_EXN(_fx_cleanup);
   }
   FX_COPY_PTR(__fold_result___0, fx_result);

_fx_cleanup: ;
   if (__fold_result___0) {
      _fx_free_LS(&__fold_result___0);
   }
   return fx_status;
}

FX_EXTERN_C int _fx_M8K_mangleFM4joinS2SLS(fx_str_t* sep_0, struct _fx_LS_data_t* strs_0, fx_str_t* fx_result, void* fx_fv)
{
   int fx_status = 0;
   FX_CALL(_fx_F4joinS2SLS(sep_0, strs_0, fx_result, 0), _fx_cleanup);

_fx_cleanup: ;
   return fx_status;
}

FX_EXTERN_C int _fx_M8K_mangleFM1tNt10Hashmap__t2ii6Rt20Hashmap__hashentry_t2iiiiiA1iA1Rt20Hashmap__hashentry_t2ii(
   struct _fx_Rt20Hashmap__hashentry_t2ii* arg0,
   int_ arg1,
   int_ arg2,
   int_ arg3,
   fx_arr_t* arg4,
   fx_arr_t* arg5,
   struct _fx_Nt10Hashmap__t2ii_data_t** fx_result)
{
   FX_MAKE_RECURSIVE_VARIANT_IMPL_START(_fx_Nt10Hashmap__t2ii);
   v->u.t.t0 = *arg0;
   v->u.t.t1 = arg1;
   v->u.t.t2 = arg2;
   v->u.t.t3 = arg3;
   fx_copy_arr(arg4, &v->u.t.t4);
   fx_copy_arr(arg5, &v->u.t.t5);
   return 0;
}

FX_EXTERN_C int
   _fx_M8K_mangleFM1tNt10Hashmap__t2SR9Ast__id_t6Rt20Hashmap__hashentry_t2SR9Ast__id_tiiiA1iA1Rt20Hashmap__hashentry_t2SR9Ast__id_t(
   struct _fx_Rt20Hashmap__hashentry_t2SR9Ast__id_t* arg0,
   int_ arg1,
   int_ arg2,
   int_ arg3,
   fx_arr_t* arg4,
   fx_arr_t* arg5,
   struct _fx_Nt10Hashmap__t2SR9Ast__id_t_data_t** fx_result)
{
   FX_MAKE_RECURSIVE_VARIANT_IMPL_START(_fx_Nt10Hashmap__t2SR9Ast__id_t);
   _fx_copy_Rt20Hashmap__hashentry_t2SR9Ast__id_t(arg0, &v->u.t.t0);
   v->u.t.t1 = arg1;
   v->u.t.t2 = arg2;
   v->u.t.t3 = arg3;
   fx_copy_arr(arg4, &v->u.t.t4);
   fx_copy_arr(arg5, &v->u.t.t5);
   return 0;
}

FX_EXTERN_C int _fx_M8K_mangleFM5emptyNt10Hashmap__t2SR9Ast__id_t3iSR9Ast__id_t(
   int_ size0_0,
   fx_str_t* k0_0,
   struct _fx_R9Ast__id_t* d0_0,
   struct _fx_Nt10Hashmap__t2SR9Ast__id_t_data_t** fx_result,
   void* fx_fv)
{
   _fx_Rt20Hashmap__hashentry_t2SR9Ast__id_t entry0_0 = {0};
   fx_arr_t v_0 = {0};
   fx_arr_t v_1 = {0};
   int fx_status = 0;
   int_ size_0 = 8;
   while (size_0 < size0_0) {
      size_0 = size_0 * 2;
   }
   int_ idxsize_0 = size_0 * 2;
   _fx_make_Rt20Hashmap__hashentry_t2SR9Ast__id_t(0ULL, k0_0, d0_0, &entry0_0);
   FX_CALL(_fx_M7HashmapFM9makeindexA1i1i(idxsize_0, &v_0, 0), _fx_cleanup);
   _fx_Rt20Hashmap__hashentry_t2SR9Ast__id_t* dstptr_0 = 0;
   int_ n_0 = size_0;
   {
      const int_ shape_0[] = { n_0 };
      FX_CALL(
         fx_make_arr(1, shape_0, sizeof(_fx_Rt20Hashmap__hashentry_t2SR9Ast__id_t),
            (fx_free_t)_fx_free_Rt20Hashmap__hashentry_t2SR9Ast__id_t,
            (fx_copy_t)_fx_copy_Rt20Hashmap__hashentry_t2SR9Ast__id_t, 0, &v_1), _fx_cleanup);
   }
   dstptr_0 = (_fx_Rt20Hashmap__hashentry_t2SR9Ast__id_t*)v_1.data;
   for (int_ i_0 = 0; i_0 < n_0; i_0++, dstptr_0++) {
      _fx_copy_Rt20Hashmap__hashentry_t2SR9Ast__id_t(&entry0_0, dstptr_0);
   }
   FX_CALL(
      _fx_M8K_mangleFM1tNt10Hashmap__t2SR9Ast__id_t6Rt20Hashmap__hashentry_t2SR9Ast__id_tiiiA1iA1Rt20Hashmap__hashentry_t2SR9Ast__id_t(
         &entry0_0, 0, 0, 0, &v_0, &v_1, fx_result), _fx_cleanup);

_fx_cleanup: ;
   _fx_free_Rt20Hashmap__hashentry_t2SR9Ast__id_t(&entry0_0);
   FX_FREE_ARR(&v_0);
   FX_FREE_ARR(&v_1);
   return fx_status;
}

FX_EXTERN_C int _fx_M8K_mangleFM5clearv1Nt10Hashmap__t2SR9Ast__id_t(
   struct _fx_Nt10Hashmap__t2SR9Ast__id_t_data_t* self_0,
   void* fx_fv)
{
   _fx_Rt20Hashmap__hashentry_t2SR9Ast__id_t entry0_0 = {0};
   fx_arr_t table_0 = {0};
   fx_arr_t v_0 = {0};
   int fx_status = 0;
   _fx_copy_Rt20Hashmap__hashentry_t2SR9Ast__id_t(&self_0->u.t.t0, &entry0_0);
   fx_copy_arr(&self_0->u.t.t5, &table_0);
   int_ v_1 = FX_ARR_SIZE(table_0, 0);
   FX_CHKIDX_RANGE(FX_ARR_SIZE(table_0, 0), 0, v_1, 1, 1, 0, _fx_cleanup);
   _fx_Rt20Hashmap__hashentry_t2SR9Ast__id_t* ptr_0 = FX_PTR_1D(_fx_Rt20Hashmap__hashentry_t2SR9Ast__id_t, table_0, 0);
   for (int_ i_0 = 0; i_0 < v_1; i_0++) {
      _fx_Rt20Hashmap__hashentry_t2SR9Ast__id_t* v_2 = ptr_0 + i_0;
      _fx_free_Rt20Hashmap__hashentry_t2SR9Ast__id_t(v_2);
      _fx_copy_Rt20Hashmap__hashentry_t2SR9Ast__id_t(&entry0_0, v_2);
   }
   self_0->u.t.t1 = 0;
   self_0->u.t.t2 = 0;
   self_0->u.t.t3 = 0;
   FX_CALL(_fx_M7HashmapFM9makeindexA1i1i(FX_ARR_SIZE(table_0, 0) * 2, &v_0, 0), _fx_cleanup);
   fx_arr_t* v_3 = &self_0->u.t.t4;
   FX_FREE_ARR(v_3);
   fx_copy_arr(&v_0, v_3);

_fx_cleanup: ;
   _fx_free_Rt20Hashmap__hashentry_t2SR9Ast__id_t(&entry0_0);
   FX_FREE_ARR(&table_0);
   FX_FREE_ARR(&v_0);
   return fx_status;
}

FX_EXTERN_C int _fx_M8K_mangleFM9add_fast_i4iA1iA1Rt20Hashmap__hashentry_t2iiRt20Hashmap__hashentry_t2ii(
   int_ tabsz_0,
   fx_arr_t* ht_index_0,
   fx_arr_t* ht_table_0,
   struct _fx_Rt20Hashmap__hashentry_t2ii* entry_0,
   int_* fx_result,
   void* fx_fv)
{
   fx_exn_t v_0 = {0};
   int fx_status = 0;
   int_ idxsz_0 = FX_ARR_SIZE(*ht_index_0, 0);
   uint64_t hv_0 = entry_0->hv;
   uint64_t perturb_0 = hv_0;
   int_ j_0 = (int_)hv_0 & (idxsz_0 - 1);
   bool found_free_slot_0 = false;
   int_ v_1 = idxsz_0 + 14;
   for (int_ i_0 = 0; i_0 < v_1; i_0++) {
      FX_CHKIDX(FX_CHKIDX1(*ht_index_0, 0, j_0), _fx_catch_0);
      int_ tidx_0 = *FX_PTR_1D(int_, *ht_index_0, j_0);
      if (tidx_0 == 0) {
         FX_CHKIDX(FX_CHKIDX1(*ht_index_0, 0, j_0), _fx_catch_0);
         *FX_PTR_1D(int_, *ht_index_0, j_0) = tabsz_0 + 2;
         FX_CHKIDX(FX_CHKIDX1(*ht_table_0, 0, tabsz_0), _fx_catch_0);
         *FX_PTR_1D(_fx_Rt20Hashmap__hashentry_t2ii, *ht_table_0, tabsz_0) = *entry_0;
         found_free_slot_0 = true;
         FX_BREAK(_fx_catch_0);
      }
      perturb_0 = perturb_0 >> 5;
      j_0 = (int_)((uint64_t)(j_0 * 5 + 1) + perturb_0) & (idxsz_0 - 1);

   _fx_catch_0: ;
      FX_CHECK_BREAK();
      FX_CHECK_EXN(_fx_cleanup);
   }
   if (!found_free_slot_0) {
      fx_str_t slit_0 = FX_MAKE_STR("cannot insert element (full Hashtable?!)");
      FX_CALL(_fx_F9make_FailE1S(&slit_0, &v_0), _fx_cleanup);
      FX_THROW(&v_0, true, _fx_cleanup);
   }
   *fx_result = tabsz_0 + 1;

_fx_cleanup: ;
   fx_free_exn(&v_0);
   return fx_status;
}

FX_EXTERN_C int _fx_M8K_mangleFM9add_fast_i4iA1iA1Rt20Hashmap__hashentry_t2SR9Ast__id_tRt20Hashmap__hashentry_t2SR9Ast__id_t(
   int_ tabsz_0,
   fx_arr_t* ht_index_0,
   fx_arr_t* ht_table_0,
   struct _fx_Rt20Hashmap__hashentry_t2SR9Ast__id_t* entry_0,
   int_* fx_result,
   void* fx_fv)
{
   fx_exn_t v_0 = {0};
   int fx_status = 0;
   int_ idxsz_0 = FX_ARR_SIZE(*ht_index_0, 0);
   uint64_t hv_0 = entry_0->hv;
   uint64_t perturb_0 = hv_0;
   int_ j_0 = (int_)hv_0 & (idxsz_0 - 1);
   bool found_free_slot_0 = false;
   int_ v_1 = idxsz_0 + 14;
   for (int_ i_0 = 0; i_0 < v_1; i_0++) {
      FX_CHKIDX(FX_CHKIDX1(*ht_index_0, 0, j_0), _fx_catch_0);
      int_ tidx_0 = *FX_PTR_1D(int_, *ht_index_0, j_0);
      if (tidx_0 == 0) {
         FX_CHKIDX(FX_CHKIDX1(*ht_index_0, 0, j_0), _fx_catch_0);
         *FX_PTR_1D(int_, *ht_index_0, j_0) = tabsz_0 + 2;
         FX_CHKIDX(FX_CHKIDX1(*ht_table_0, 0, tabsz_0), _fx_catch_0);
         _fx_Rt20Hashmap__hashentry_t2SR9Ast__id_t* v_2 =
            FX_PTR_1D(_fx_Rt20Hashmap__hashentry_t2SR9Ast__id_t, *ht_table_0, tabsz_0);
         _fx_free_Rt20Hashmap__hashentry_t2SR9Ast__id_t(v_2);
         _fx_copy_Rt20Hashmap__hashentry_t2SR9Ast__id_t(entry_0, v_2);
         found_free_slot_0 = true;
         FX_BREAK(_fx_catch_0);
      }
      perturb_0 = perturb_0 >> 5;
      j_0 = (int_)((uint64_t)(j_0 * 5 + 1) + perturb_0) & (idxsz_0 - 1);

   _fx_catch_0: ;
      FX_CHECK_BREAK();
      FX_CHECK_EXN(_fx_cleanup);
   }
   if (!found_free_slot_0) {
      fx_str_t slit_0 = FX_MAKE_STR("cannot insert element (full Hashtable?!)");
      FX_CALL(_fx_F9make_FailE1S(&slit_0, &v_0), _fx_cleanup);
      FX_THROW(&v_0, true, _fx_cleanup);
   }
   *fx_result = tabsz_0 + 1;

_fx_cleanup: ;
   fx_free_exn(&v_0);
   return fx_status;
}

FX_EXTERN_C int _fx_M8K_mangleFM4growv2Nt10Hashmap__t2iii(
   struct _fx_Nt10Hashmap__t2ii_data_t* self_0,
   int_ new_size_0,
   void* fx_fv)
{
   fx_arr_t ht_table_0 = {0};
   fx_arr_t new_ht_table_0 = {0};
   fx_arr_t new_ht_index_0 = {0};
   int fx_status = 0;
   fx_copy_arr(&self_0->u.t.t5, &ht_table_0);
   _fx_Rt20Hashmap__hashentry_t2ii v_0 = self_0->u.t.t0;
   _fx_Rt20Hashmap__hashentry_t2ii* dstptr_0 = 0;
   {
      const int_ shape_0[] = { new_size_0 };
      FX_CALL(fx_make_arr(1, shape_0, sizeof(_fx_Rt20Hashmap__hashentry_t2ii), 0, 0, 0, &new_ht_table_0), _fx_cleanup);
   }
   dstptr_0 = (_fx_Rt20Hashmap__hashentry_t2ii*)new_ht_table_0.data;
   for (int_ i_0 = 0; i_0 < new_size_0; i_0++, dstptr_0++) {
      *dstptr_0 = v_0;
   }
   FX_CALL(_fx_M7HashmapFM9makeindexA1i1i(new_size_0 * 2, &new_ht_index_0, 0), _fx_cleanup);
   int_ tabsz_0 = 0;
   int_ v_1 = self_0->u.t.t2;
   for (int_ j_0 = 0; j_0 < v_1; j_0++) {
      FX_CHKIDX(FX_CHKIDX1(ht_table_0, 0, j_0), _fx_catch_0);
      if (FX_PTR_1D(_fx_Rt20Hashmap__hashentry_t2ii, ht_table_0, j_0)->hv < 9223372036854775808ULL) {
         FX_CHKIDX(FX_CHKIDX1(ht_table_0, 0, j_0), _fx_catch_0);
         _fx_Rt20Hashmap__hashentry_t2ii v_2 = *FX_PTR_1D(_fx_Rt20Hashmap__hashentry_t2ii, ht_table_0, j_0);
         int_ v_3;
         FX_CALL(
            _fx_M8K_mangleFM9add_fast_i4iA1iA1Rt20Hashmap__hashentry_t2iiRt20Hashmap__hashentry_t2ii(tabsz_0, &new_ht_index_0,
               &new_ht_table_0, &v_2, &v_3, 0), _fx_catch_0);
         tabsz_0 = v_3;
      }

   _fx_catch_0: ;
      FX_CHECK_EXN(_fx_cleanup);
   }
   fx_arr_t* v_4 = &self_0->u.t.t4;
   FX_FREE_ARR(v_4);
   fx_copy_arr(&new_ht_index_0, v_4);
   fx_arr_t* v_5 = &self_0->u.t.t5;
   FX_FREE_ARR(v_5);
   fx_copy_arr(&new_ht_table_0, v_5);
   self_0->u.t.t2 = tabsz_0;
   self_0->u.t.t3 = 0;

_fx_cleanup: ;
   FX_FREE_ARR(&ht_table_0);
   FX_FREE_ARR(&new_ht_table_0);
   FX_FREE_ARR(&new_ht_index_0);
   return fx_status;
}

FX_EXTERN_C int _fx_M8K_mangleFM4growv2Nt10Hashmap__t2SR9Ast__id_ti(
   struct _fx_Nt10Hashmap__t2SR9Ast__id_t_data_t* self_0,
   int_ new_size_0,
   void* fx_fv)
{
   fx_arr_t ht_table_0 = {0};
   _fx_Rt20Hashmap__hashentry_t2SR9Ast__id_t v_0 = {0};
   fx_arr_t new_ht_table_0 = {0};
   fx_arr_t new_ht_index_0 = {0};
   int fx_status = 0;
   fx_copy_arr(&self_0->u.t.t5, &ht_table_0);
   _fx_copy_Rt20Hashmap__hashentry_t2SR9Ast__id_t(&self_0->u.t.t0, &v_0);
   _fx_Rt20Hashmap__hashentry_t2SR9Ast__id_t* dstptr_0 = 0;
   {
      const int_ shape_0[] = { new_size_0 };
      FX_CALL(
         fx_make_arr(1, shape_0, sizeof(_fx_Rt20Hashmap__hashentry_t2SR9Ast__id_t),
            (fx_free_t)_fx_free_Rt20Hashmap__hashentry_t2SR9Ast__id_t,
            (fx_copy_t)_fx_copy_Rt20Hashmap__hashentry_t2SR9Ast__id_t, 0, &new_ht_table_0), _fx_cleanup);
   }
   dstptr_0 = (_fx_Rt20Hashmap__hashentry_t2SR9Ast__id_t*)new_ht_table_0.data;
   for (int_ i_0 = 0; i_0 < new_size_0; i_0++, dstptr_0++) {
      _fx_copy_Rt20Hashmap__hashentry_t2SR9Ast__id_t(&v_0, dstptr_0);
   }
   FX_CALL(_fx_M7HashmapFM9makeindexA1i1i(new_size_0 * 2, &new_ht_index_0, 0), _fx_cleanup);
   int_ tabsz_0 = 0;
   int_ v_1 = self_0->u.t.t2;
   for (int_ j_0 = 0; j_0 < v_1; j_0++) {
      _fx_Rt20Hashmap__hashentry_t2SR9Ast__id_t v_2 = {0};
      FX_CHKIDX(FX_CHKIDX1(ht_table_0, 0, j_0), _fx_catch_0);
      if (FX_PTR_1D(_fx_Rt20Hashmap__hashentry_t2SR9Ast__id_t, ht_table_0, j_0)->hv < 9223372036854775808ULL) {
         FX_CHKIDX(FX_CHKIDX1(ht_table_0, 0, j_0), _fx_catch_0);
         _fx_copy_Rt20Hashmap__hashentry_t2SR9Ast__id_t(FX_PTR_1D(_fx_Rt20Hashmap__hashentry_t2SR9Ast__id_t, ht_table_0, j_0),
            &v_2);
         int_ v_3;
         FX_CALL(
            _fx_M8K_mangleFM9add_fast_i4iA1iA1Rt20Hashmap__hashentry_t2SR9Ast__id_tRt20Hashmap__hashentry_t2SR9Ast__id_t(
               tabsz_0, &new_ht_index_0, &new_ht_table_0, &v_2, &v_3, 0), _fx_catch_0);
         tabsz_0 = v_3;
      }

   _fx_catch_0: ;
      _fx_free_Rt20Hashmap__hashentry_t2SR9Ast__id_t(&v_2);
      FX_CHECK_EXN(_fx_cleanup);
   }
   fx_arr_t* v_4 = &self_0->u.t.t4;
   FX_FREE_ARR(v_4);
   fx_copy_arr(&new_ht_index_0, v_4);
   fx_arr_t* v_5 = &self_0->u.t.t5;
   FX_FREE_ARR(v_5);
   fx_copy_arr(&new_ht_table_0, v_5);
   self_0->u.t.t2 = tabsz_0;
   self_0->u.t.t3 = 0;

_fx_cleanup: ;
   FX_FREE_ARR(&ht_table_0);
   _fx_free_Rt20Hashmap__hashentry_t2SR9Ast__id_t(&v_0);
   FX_FREE_ARR(&new_ht_table_0);
   FX_FREE_ARR(&new_ht_index_0);
   return fx_status;
}

FX_EXTERN_C int _fx_M8K_mangleFM9find_idx_Ta2i2Nt10Hashmap__t2SR9Ast__id_tS(
   struct _fx_Nt10Hashmap__t2SR9Ast__id_t_data_t* self_0,
   fx_str_t* k_0,
   struct _fx_Ta2i* fx_result,
   void* fx_fv)
{
   fx_arr_t v_0 = {0};
   int fx_status = 0;
   uint64_t v_1 = _fx_F4hashq1S(k_0, 0);
   uint64_t hv_0 = v_1 & 9223372036854775807ULL;
   fx_copy_arr(&self_0->u.t.t4, &v_0);
   int_ idxsz_0 = FX_ARR_SIZE(v_0, 0);
   uint64_t perturb_0 = hv_0;
   int_ found_0 = -1;
   int_ j_0 = (int_)hv_0 & (idxsz_0 - 1);
   int_ v_2 = idxsz_0 + 14;
   for (int_ i_0 = 0; i_0 < v_2; i_0++) {
      _fx_Rt20Hashmap__hashentry_t2SR9Ast__id_t entry_0 = {0};
      fx_str_t v_3 = {0};
      FX_CHKIDX(FX_CHKIDX1(self_0->u.t.t4, 0, j_0), _fx_catch_0);
      int_ tidx_0 = *FX_PTR_1D(int_, self_0->u.t.t4, j_0);
      if (tidx_0 >= 2) {
         int_ v_4 = tidx_0 - 2;
         FX_CHKIDX(FX_CHKIDX1(self_0->u.t.t5, 0, v_4), _fx_catch_0);
         _fx_copy_Rt20Hashmap__hashentry_t2SR9Ast__id_t(
            FX_PTR_1D(_fx_Rt20Hashmap__hashentry_t2SR9Ast__id_t, self_0->u.t.t5, v_4), &entry_0);
         bool v_5;
         if (entry_0.hv == hv_0) {
            fx_copy_str(&entry_0.key, &v_3); v_5 = _fx_F6__eq__B2SS(&v_3, k_0, 0);
         }
         else {
            v_5 = false;
         }
         if (v_5) {
            found_0 = tidx_0 - 2; FX_BREAK(_fx_catch_0);
         }
      }
      else if (tidx_0 == 0) {
         FX_BREAK(_fx_catch_0);
      }
      perturb_0 = perturb_0 >> 5;
      j_0 = (int_)((uint64_t)(j_0 * 5 + 1) + perturb_0) & (idxsz_0 - 1);

   _fx_catch_0: ;
      FX_FREE_STR(&v_3);
      _fx_free_Rt20Hashmap__hashentry_t2SR9Ast__id_t(&entry_0);
      FX_CHECK_BREAK();
      FX_CHECK_EXN(_fx_cleanup);
   }
   _fx_Ta2i tup_0 = { j_0, found_0 };
   *fx_result = tup_0;

_fx_cleanup: ;
   FX_FREE_ARR(&v_0);
   return fx_status;
}

FX_EXTERN_C int _fx_M8K_mangleFM18find_idx_or_inserti2Nt10Hashmap__t2iii(
   struct _fx_Nt10Hashmap__t2ii_data_t* self_0,
   int_ k_0,
   int_* fx_result,
   void* fx_fv)
{
   fx_arr_t v_0 = {0};
   fx_arr_t v_1 = {0};
   fx_exn_t v_2 = {0};
   int fx_status = 0;
   uint64_t hv_0 = ((uint64_t)k_0 ^ 14695981039346656037ULL) & 9223372036854775807ULL;
   fx_copy_arr(&self_0->u.t.t4, &v_0);
   int_ idxsz_0 = FX_ARR_SIZE(v_0, 0);
   if (self_0->u.t.t1 + 1 > idxsz_0 >> 1) {
      while (idxsz_0 < (self_0->u.t.t1 + 1) * 2) {
         idxsz_0 = idxsz_0 * 2;
      }
      FX_CALL(_fx_M8K_mangleFM4growv2Nt10Hashmap__t2iii(self_0, fx_maxi(idxsz_0 / 2, self_0->u.t.t1 + 1), 0), _fx_cleanup);
   }
   uint64_t perturb_0 = hv_0;
   int_ found_0 = -1;
   int_ insert_idx_0 = -1;
   int_ j_0 = (int_)hv_0 & (idxsz_0 - 1);
   int_ v_3 = idxsz_0 + 14;
   for (int_ i_0 = 0; i_0 < v_3; i_0++) {
      FX_CHKIDX(FX_CHKIDX1(self_0->u.t.t4, 0, j_0), _fx_catch_0);
      int_ tidx_0 = *FX_PTR_1D(int_, self_0->u.t.t4, j_0);
      if (tidx_0 >= 2) {
         int_ v_4 = tidx_0 - 2;
         FX_CHKIDX(FX_CHKIDX1(self_0->u.t.t5, 0, v_4), _fx_catch_0);
         _fx_Rt20Hashmap__hashentry_t2ii entry_0 = *FX_PTR_1D(_fx_Rt20Hashmap__hashentry_t2ii, self_0->u.t.t5, v_4);
         bool t_0;
         if (entry_0.hv == hv_0) {
            t_0 = entry_0.key == k_0;
         }
         else {
            t_0 = false;
         }
         if (t_0) {
            found_0 = tidx_0 - 2; FX_BREAK(_fx_catch_0);
         }
      }
      else if (tidx_0 == 0) {
         if (insert_idx_0 < 0) {
            insert_idx_0 = j_0;
         }
         FX_BREAK(_fx_catch_0);
      }
      else {
         bool t_1;
         if (tidx_0 == 1) {
            t_1 = insert_idx_0 < 0;
         }
         else {
            t_1 = false;
         }
         if (t_1) {
            insert_idx_0 = j_0;
         }
      }
      perturb_0 = perturb_0 >> 5;
      j_0 = (int_)((uint64_t)(j_0 * 5 + 1) + perturb_0) & (idxsz_0 - 1);

   _fx_catch_0: ;
      FX_CHECK_BREAK();
      FX_CHECK_EXN(_fx_cleanup);
   }
   if (found_0 >= 0) {
      bool t_2;
      if (insert_idx_0 >= 0) {
         t_2 = insert_idx_0 != j_0;
      }
      else {
         t_2 = false;
      }
      if (t_2) {
         FX_CHKIDX(FX_CHKIDX1(self_0->u.t.t4, 0, insert_idx_0), _fx_cleanup);
         *FX_PTR_1D(int_, self_0->u.t.t4, insert_idx_0) = found_0 + 2;
         FX_CHKIDX(FX_CHKIDX1(self_0->u.t.t4, 0, j_0), _fx_cleanup);
         *FX_PTR_1D(int_, self_0->u.t.t4, j_0) = 1;
      }
   }
   else if (insert_idx_0 >= 0) {
      found_0 = self_0->u.t.t3 - 1;
      if (found_0 >= 0) {
         FX_CHKIDX(FX_CHKIDX1(self_0->u.t.t5, 0, found_0), _fx_cleanup);
         self_0->u.t.t3 =
            (int_)(FX_PTR_1D(_fx_Rt20Hashmap__hashentry_t2ii, self_0->u.t.t5, found_0)->hv & 9223372036854775807ULL);
      }
      else {
         found_0 = self_0->u.t.t2;
         self_0->u.t.t2 = self_0->u.t.t2 + 1;
         fx_copy_arr(&self_0->u.t.t5, &v_1);
         FX_CALL(_fx_F6assertv1B(found_0 < FX_ARR_SIZE(v_1, 0), 0), _fx_cleanup);
      }
      _fx_Rt20Hashmap__hashentry_t2ii v_5 = { hv_0, k_0, self_0->u.t.t0.data };
      FX_CHKIDX(FX_CHKIDX1(self_0->u.t.t5, 0, found_0), _fx_cleanup);
      *FX_PTR_1D(_fx_Rt20Hashmap__hashentry_t2ii, self_0->u.t.t5, found_0) = v_5;
      FX_CHKIDX(FX_CHKIDX1(self_0->u.t.t4, 0, insert_idx_0), _fx_cleanup);
      *FX_PTR_1D(int_, self_0->u.t.t4, insert_idx_0) = found_0 + 2;
      self_0->u.t.t1 = self_0->u.t.t1 + 1;
   }
   else {
      fx_str_t slit_0 = FX_MAKE_STR("cannot insert element (full Hashtable?!)");
      FX_CALL(_fx_F9make_FailE1S(&slit_0, &v_2), _fx_cleanup);
      FX_THROW(&v_2, true, _fx_cleanup);
   }
   *fx_result = found_0;

_fx_cleanup: ;
   FX_FREE_ARR(&v_0);
   FX_FREE_ARR(&v_1);
   fx_free_exn(&v_2);
   return fx_status;
}

FX_EXTERN_C int _fx_M8K_mangleFM18find_idx_or_inserti2Nt10Hashmap__t2SR9Ast__id_tS(
   struct _fx_Nt10Hashmap__t2SR9Ast__id_t_data_t* self_0,
   fx_str_t* k_0,
   int_* fx_result,
   void* fx_fv)
{
   fx_arr_t v_0 = {0};
   fx_arr_t v_1 = {0};
   _fx_Rt20Hashmap__hashentry_t2SR9Ast__id_t v_2 = {0};
   fx_exn_t v_3 = {0};
   int fx_status = 0;
   uint64_t v_4 = _fx_F4hashq1S(k_0, 0);
   uint64_t hv_0 = v_4 & 9223372036854775807ULL;
   fx_copy_arr(&self_0->u.t.t4, &v_0);
   int_ idxsz_0 = FX_ARR_SIZE(v_0, 0);
   if (self_0->u.t.t1 + 1 > idxsz_0 >> 1) {
      while (idxsz_0 < (self_0->u.t.t1 + 1) * 2) {
         idxsz_0 = idxsz_0 * 2;
      }
      FX_CALL(_fx_M8K_mangleFM4growv2Nt10Hashmap__t2SR9Ast__id_ti(self_0, fx_maxi(idxsz_0 / 2, self_0->u.t.t1 + 1), 0),
         _fx_cleanup);
   }
   uint64_t perturb_0 = hv_0;
   int_ found_0 = -1;
   int_ insert_idx_0 = -1;
   int_ j_0 = (int_)hv_0 & (idxsz_0 - 1);
   int_ v_5 = idxsz_0 + 14;
   for (int_ i_0 = 0; i_0 < v_5; i_0++) {
      _fx_Rt20Hashmap__hashentry_t2SR9Ast__id_t entry_0 = {0};
      fx_str_t v_6 = {0};
      FX_CHKIDX(FX_CHKIDX1(self_0->u.t.t4, 0, j_0), _fx_catch_0);
      int_ tidx_0 = *FX_PTR_1D(int_, self_0->u.t.t4, j_0);
      if (tidx_0 >= 2) {
         int_ v_7 = tidx_0 - 2;
         FX_CHKIDX(FX_CHKIDX1(self_0->u.t.t5, 0, v_7), _fx_catch_0);
         _fx_copy_Rt20Hashmap__hashentry_t2SR9Ast__id_t(
            FX_PTR_1D(_fx_Rt20Hashmap__hashentry_t2SR9Ast__id_t, self_0->u.t.t5, v_7), &entry_0);
         bool v_8;
         if (entry_0.hv == hv_0) {
            fx_copy_str(&entry_0.key, &v_6); v_8 = _fx_F6__eq__B2SS(&v_6, k_0, 0);
         }
         else {
            v_8 = false;
         }
         if (v_8) {
            found_0 = tidx_0 - 2; FX_BREAK(_fx_catch_0);
         }
      }
      else if (tidx_0 == 0) {
         if (insert_idx_0 < 0) {
            insert_idx_0 = j_0;
         }
         FX_BREAK(_fx_catch_0);
      }
      else {
         bool t_0;
         if (tidx_0 == 1) {
            t_0 = insert_idx_0 < 0;
         }
         else {
            t_0 = false;
         }
         if (t_0) {
            insert_idx_0 = j_0;
         }
      }
      perturb_0 = perturb_0 >> 5;
      j_0 = (int_)((uint64_t)(j_0 * 5 + 1) + perturb_0) & (idxsz_0 - 1);

   _fx_catch_0: ;
      FX_FREE_STR(&v_6);
      _fx_free_Rt20Hashmap__hashentry_t2SR9Ast__id_t(&entry_0);
      FX_CHECK_BREAK();
      FX_CHECK_EXN(_fx_cleanup);
   }
   if (found_0 >= 0) {
      bool t_1;
      if (insert_idx_0 >= 0) {
         t_1 = insert_idx_0 != j_0;
      }
      else {
         t_1 = false;
      }
      if (t_1) {
         FX_CHKIDX(FX_CHKIDX1(self_0->u.t.t4, 0, insert_idx_0), _fx_cleanup);
         *FX_PTR_1D(int_, self_0->u.t.t4, insert_idx_0) = found_0 + 2;
         FX_CHKIDX(FX_CHKIDX1(self_0->u.t.t4, 0, j_0), _fx_cleanup);
         *FX_PTR_1D(int_, self_0->u.t.t4, j_0) = 1;
      }
   }
   else if (insert_idx_0 >= 0) {
      found_0 = self_0->u.t.t3 - 1;
      if (found_0 >= 0) {
         FX_CHKIDX(FX_CHKIDX1(self_0->u.t.t5, 0, found_0), _fx_cleanup);
         self_0->u.t.t3 =
            (int_)(FX_PTR_1D(_fx_Rt20Hashmap__hashentry_t2SR9Ast__id_t, self_0->u.t.t5, found_0)->hv & 9223372036854775807ULL);
      }
      else {
         found_0 = self_0->u.t.t2;
         self_0->u.t.t2 = self_0->u.t.t2 + 1;
         fx_copy_arr(&self_0->u.t.t5, &v_1);
         FX_CALL(_fx_F6assertv1B(found_0 < FX_ARR_SIZE(v_1, 0), 0), _fx_cleanup);
      }
      _fx_R9Ast__id_t v_9 = self_0->u.t.t0.data;
      _fx_make_Rt20Hashmap__hashentry_t2SR9Ast__id_t(hv_0, k_0, &v_9, &v_2);
      FX_CHKIDX(FX_CHKIDX1(self_0->u.t.t5, 0, found_0), _fx_cleanup);
      _fx_Rt20Hashmap__hashentry_t2SR9Ast__id_t* v_10 =
         FX_PTR_1D(_fx_Rt20Hashmap__hashentry_t2SR9Ast__id_t, self_0->u.t.t5, found_0);
      _fx_free_Rt20Hashmap__hashentry_t2SR9Ast__id_t(v_10);
      _fx_copy_Rt20Hashmap__hashentry_t2SR9Ast__id_t(&v_2, v_10);
      FX_CHKIDX(FX_CHKIDX1(self_0->u.t.t4, 0, insert_idx_0), _fx_cleanup);
      *FX_PTR_1D(int_, self_0->u.t.t4, insert_idx_0) = found_0 + 2;
      self_0->u.t.t1 = self_0->u.t.t1 + 1;
   }
   else {
      fx_str_t slit_0 = FX_MAKE_STR("cannot insert element (full Hashtable?!)");
      FX_CALL(_fx_F9make_FailE1S(&slit_0, &v_3), _fx_cleanup);
      FX_THROW(&v_3, true, _fx_cleanup);
   }
   *fx_result = found_0;

_fx_cleanup: ;
   FX_FREE_ARR(&v_0);
   FX_FREE_ARR(&v_1);
   _fx_free_Rt20Hashmap__hashentry_t2SR9Ast__id_t(&v_2);
   fx_free_exn(&v_3);
   return fx_status;
}

FX_EXTERN_C int _fx_M8K_mangleFM12mangle_mnameS1S(fx_str_t* m_0, fx_str_t* fx_result, void* fx_fv)
{
   int fx_status = 0;
   fx_str_t slit_0 = FX_MAKE_STR(".");
   fx_str_t slit_1 = FX_MAKE_STR("__");
   FX_CALL(_fx_M6StringFM7replaceS3SSS(m_0, &slit_0, &slit_1, fx_result, 0), _fx_cleanup);

_fx_cleanup: ;
   return fx_status;
}

FX_EXTERN_C int _fx_M8K_mangleFM12mangle_scopeS3LN12Ast__scope_tSR10Ast__loc_t(
   struct _fx_LN12Ast__scope_t_data_t* sc_0,
   fx_str_t* result_0,
   struct _fx_R10Ast__loc_t* loc_0,
   fx_str_t* fx_result,
   void* fx_fv)
{
   fx_str_t result_1 = {0};
   _fx_LN12Ast__scope_t sc_1 = 0;
   fx_str_t result_2 = {0};
   int fx_status = 0;
   FX_COPY_PTR(sc_0, &sc_1);
   fx_copy_str(result_0, &result_2);
   _fx_R10Ast__loc_t loc_1 = *loc_0;
   for (;;) {
      _fx_LN12Ast__scope_t sc_2 = 0;
      fx_str_t result_3 = {0};
      FX_COPY_PTR(sc_1, &sc_2);
      fx_copy_str(&result_2, &result_3);
      _fx_R10Ast__loc_t loc_2 = loc_1;
      if (sc_2 != 0) {
         _fx_N12Ast__scope_t* v_0 = &sc_2->hd;
         if (v_0->tag == 10) {
            fx_str_t v_1 = {0};
            fx_str_t mstr_0 = {0};
            fx_str_t result_4 = {0};
            _fx_R9Ast__id_t v_2;
            FX_CALL(_fx_M3AstFM15get_module_nameRM4id_t1i(v_0->u.ScModule, &v_2, 0), _fx_catch_0);
            FX_CALL(_fx_M3AstFM2ppS1RM4id_t(&v_2, &v_1, 0), _fx_catch_0);
            fx_str_t slit_0 = FX_MAKE_STR(".");
            fx_str_t slit_1 = FX_MAKE_STR("__");
            FX_CALL(_fx_M6StringFM7replaceS3SSS(&v_1, &slit_0, &slit_1, &mstr_0, 0), _fx_catch_0);
            bool v_3;
            fx_str_t slit_2 = FX_MAKE_STR("Builtins");
            v_3 = _fx_F6__eq__B2SS(&mstr_0, &slit_2, 0);
            if (v_3) {
               fx_copy_str(&result_3, &result_4);
            }
            else if (FX_STR_LENGTH(result_3) == 0) {
               fx_copy_str(&mstr_0, &result_4);
            }
            else {
               fx_str_t slit_3 = FX_MAKE_STR("__");
               {
                  const fx_str_t strs_0[] = { mstr_0, slit_3, result_3 };
                  FX_CALL(fx_strjoin(0, 0, 0, strs_0, 3, &result_4), _fx_catch_0);
               }
            }
            _fx_LN12Ast__scope_t* rest_0 = &sc_2->tl;
            FX_FREE_LIST_SIMPLE(&sc_1);
            FX_COPY_PTR(*rest_0, &sc_1);
            FX_FREE_STR(&result_2);
            fx_copy_str(&result_4, &result_2);
            loc_1 = loc_2;

         _fx_catch_0: ;
            FX_FREE_STR(&result_4);
            FX_FREE_STR(&mstr_0);
            FX_FREE_STR(&v_1);
            goto _fx_endmatch_0;
         }
      }
      if (sc_2 != 0) {
         _fx_LN12Ast__scope_t* rest_1 = &sc_2->tl;
         FX_FREE_LIST_SIMPLE(&sc_1);
         FX_COPY_PTR(*rest_1, &sc_1);
         FX_FREE_STR(&result_2);
         fx_copy_str(&result_3, &result_2);
         loc_1 = loc_2;
         goto _fx_endmatch_0;
      }
      FX_FREE_STR(&result_1);
      fx_copy_str(&result_3, &result_1);
      FX_BREAK(_fx_catch_1);

   _fx_catch_1: ;

   _fx_endmatch_0: ;
      FX_CHECK_EXN(_fx_catch_2);

   _fx_catch_2: ;
      FX_FREE_STR(&result_3);
      FX_FREE_LIST_SIMPLE(&sc_2);
      FX_CHECK_BREAK();
      FX_CHECK_EXN(_fx_cleanup);
   }
   fx_copy_str(&result_1, fx_result);

_fx_cleanup: ;
   FX_FREE_STR(&result_1);
   FX_FREE_LIST_SIMPLE(&sc_1);
   FX_FREE_STR(&result_2);
   return fx_status;
}

FX_EXTERN_C int _fx_M8K_mangleFM11mangle_nameS3R9Ast__id_tNt6option1LN12Ast__scope_tR10Ast__loc_t(
   struct _fx_R9Ast__id_t* n_0,
   struct _fx_Nt6option1LN12Ast__scope_t* sc_opt_0,
   struct _fx_R10Ast__loc_t* loc_0,
   fx_str_t* fx_result,
   void* fx_fv)
{
   _fx_LN12Ast__scope_t sc_0 = 0;
   fx_str_t prefix_0 = {0};
   fx_str_t nstr_0 = {0};
   int fx_status = 0;
   if (sc_opt_0->tag == 2) {
      FX_COPY_PTR(sc_opt_0->u.Some, &sc_0);
   }
   else {
      _fx_N15K_form__kinfo_t v_0 = {0};
      FX_CALL(_fx_M6K_formFM6kinfo_N15K_form__kinfo_t2R9Ast__id_tR10Ast__loc_t(n_0, loc_0, &v_0, 0), _fx_catch_0);
      FX_CALL(_fx_M6K_formFM10get_kscopeLN12Ast__scope_t1N15K_form__kinfo_t(&v_0, &sc_0, 0), _fx_catch_0);

   _fx_catch_0: ;
      _fx_free_N15K_form__kinfo_t(&v_0);
   }
   FX_CHECK_EXN(_fx_cleanup);
   fx_str_t slit_0 = FX_MAKE_STR("");
   FX_CALL(_fx_M8K_mangleFM12mangle_scopeS3LN12Ast__scope_tSR10Ast__loc_t(sc_0, &slit_0, loc_0, &prefix_0, 0), _fx_cleanup);
   FX_CALL(_fx_M3AstFM2ppS1RM4id_t(n_0, &nstr_0, 0), _fx_cleanup);
   if (FX_STR_LENGTH(prefix_0) == 0) {
      fx_copy_str(&nstr_0, fx_result);
   }
   else {
      fx_str_t slit_1 = FX_MAKE_STR("__");
      {
         const fx_str_t strs_0[] = { prefix_0, slit_1, nstr_0 };
         FX_CALL(fx_strjoin(0, 0, 0, strs_0, 3, fx_result), _fx_cleanup);
      }
   }

_fx_cleanup: ;
   FX_FREE_LIST_SIMPLE(&sc_0);
   FX_FREE_STR(&prefix_0);
   FX_FREE_STR(&nstr_0);
   return fx_status;
}

FX_EXTERN_C int _fx_M8K_mangleFM13compress_nameS3SLN12Ast__scope_tR10Ast__loc_t(
   fx_str_t* nstr_0,
   struct _fx_LN12Ast__scope_t_data_t* sc_0,
   struct _fx_R10Ast__loc_t* loc_0,
   fx_str_t* fx_result,
   void* fx_fv)
{
   fx_str_t prefix_0 = {0};
   fx_str_t prefix__0 = {0};
   fx_str_t result_0 = {0};
   fx_str_t v_0 = {0};
   fx_str_t v_1 = {0};
   fx_str_t v_2 = {0};
   int fx_status = 0;
   fx_str_t slit_0 = FX_MAKE_STR("");
   FX_CALL(_fx_M8K_mangleFM12mangle_scopeS3LN12Ast__scope_tSR10Ast__loc_t(sc_0, &slit_0, loc_0, &prefix_0, 0), _fx_cleanup);
   if (FX_STR_LENGTH(prefix_0) == 0) {
      fx_copy_str(nstr_0, fx_result);
   }
   else {
      int_ len_0 = FX_STR_LENGTH(*nstr_0);
      fx_str_t slit_1 = FX_MAKE_STR("__");
      {
         const fx_str_t strs_0[] = { prefix_0, slit_1 };
         FX_CALL(fx_strjoin(0, 0, 0, strs_0, 2, &prefix__0), _fx_cleanup);
      }
      int_ prefix_len_0 = FX_STR_LENGTH(prefix__0);
      int_ i_0 = 0;
      int_ start_0 = 0;
      fx_str_t slit_2 = FX_MAKE_STR("");
      fx_copy_str(&slit_2, &result_0);
      while (i_0 < len_0) {
         fx_str_t v_3 = {0};
         fx_str_t v_4 = {0};
         fx_str_t v_5 = {0};
         fx_str_t v_6 = {0};
         fx_str_t v_7 = {0};
         fx_str_t v_8 = {0};
         FX_STR_CHKIDX(*nstr_0, i_0, _fx_catch_1);
         char_ c_0 = FX_STR_ELEM(*nstr_0, i_0);
         i_0 = i_0 + 1;
         bool t_0;
         if (c_0 == (char_)70) {
            t_0 = true;
         }
         else {
            t_0 = c_0 == (char_)86;
         }
         bool t_1;
         if (t_0) {
            t_1 = true;
         }
         else {
            t_1 = c_0 == (char_)82;
         }
         if (t_1) {
            bool t_2;
            if (i_0 < len_0) {
               FX_STR_CHKIDX(*nstr_0, i_0, _fx_catch_1); t_2 = FX_STR_ELEM(*nstr_0, i_0) == (char_)116;
            }
            else {
               t_2 = false;
            }
            if (t_2) {
               i_0 = i_0 + 1;
            }
            int_ j_0 = i_0;
            bool v_9;
            if (i_0 < len_0) {
               FX_STR_CHKIDX(*nstr_0, i_0, _fx_catch_1); v_9 = _fx_M4CharFM7isdigitB1C(FX_STR_ELEM(*nstr_0, i_0), 0);
            }
            else {
               v_9 = false;
            }
            if (v_9) {
               for (;;) {
                  i_0 = i_0 + 1;
                  bool v_10;
                  if (i_0 >= len_0) {
                     v_10 = true;
                  }
                  else {
                     FX_STR_CHKIDX(*nstr_0, i_0, _fx_catch_0);
                     bool v_11 = _fx_M4CharFM7isdigitB1C(FX_STR_ELEM(*nstr_0, i_0), 0);
                     v_10 = !v_11;
                  }
                  if (v_10) {
                     FX_BREAK(_fx_catch_0);
                  }

               _fx_catch_0: ;
                  FX_CHECK_BREAK();
                  FX_CHECK_EXN(_fx_catch_1);
               }
               bool v_12;
               if (i_0 + prefix_len_0 <= len_0) {
                  FX_CALL(fx_substr(nstr_0, i_0, i_0 + prefix_len_0, 1, 0, &v_3), _fx_catch_1);
                  v_12 = _fx_F6__eq__B2SS(&v_3, &prefix__0, 0);
               }
               else {
                  v_12 = false;
               }
               if (v_12) {
                  FX_CALL(fx_substr(nstr_0, j_0, i_0, 1, 0, &v_4), _fx_catch_1);
                  int_ idlen0_0 = _fx_M6StringFM10to_int_or_i3Sii(&v_4, 0, 0, 0);
                  int_ idlen1_0 = idlen0_0 - prefix_len_0;
                  FX_CALL(fx_substr(nstr_0, start_0, j_0, 1, 0, &v_5), _fx_catch_1);
                  FX_CALL(_fx_F6stringS1i(idlen1_0, &v_6, 0), _fx_catch_1);
                  FX_CALL(fx_substr(nstr_0, i_0 + prefix_len_0, i_0 + idlen0_0, 1, 0, &v_7), _fx_catch_1);
                  fx_str_t slit_3 = FX_MAKE_STR("M");
                  {
                     const fx_str_t strs_1[] = { result_0, v_5, slit_3, v_6, v_7 };
                     FX_CALL(fx_strjoin(0, 0, 0, strs_1, 5, &v_8), _fx_catch_1);
                  }
                  FX_FREE_STR(&result_0);
                  fx_copy_str(&v_8, &result_0);
                  i_0 = i_0 + idlen0_0;
                  start_0 = i_0;
               }
            }
         }

      _fx_catch_1: ;
         FX_FREE_STR(&v_8);
         FX_FREE_STR(&v_7);
         FX_FREE_STR(&v_6);
         FX_FREE_STR(&v_5);
         FX_FREE_STR(&v_4);
         FX_FREE_STR(&v_3);
         FX_CHECK_EXN(_fx_cleanup);
      }
      FX_CALL(fx_substr(nstr_0, start_0, i_0, 1, 0, &v_0), _fx_cleanup);
      {
         const fx_str_t strs_2[] = { result_0, v_0 };
         FX_CALL(fx_strjoin(0, 0, 0, strs_2, 2, &v_1), _fx_cleanup);
      }
      FX_FREE_STR(&result_0);
      fx_copy_str(&v_1, &result_0);
      FX_CALL(_fx_F6stringS1i(FX_STR_LENGTH(prefix_0), &v_2, 0), _fx_cleanup);
      fx_str_t slit_4 = FX_MAKE_STR("M");
      {
         const fx_str_t strs_3[] = { slit_4, v_2, prefix_0, result_0 };
         FX_CALL(fx_strjoin(0, 0, 0, strs_3, 4, fx_result), _fx_cleanup);
      }
   }

_fx_cleanup: ;
   FX_FREE_STR(&prefix_0);
   FX_FREE_STR(&prefix__0);
   FX_FREE_STR(&result_0);
   FX_FREE_STR(&v_0);
   FX_FREE_STR(&v_1);
   FX_FREE_STR(&v_2);
   return fx_status;
}

FX_EXTERN_C int _fx_M8K_mangleFM18mangle_make_uniqueTa2S5R9Ast__id_tSSSNt10Hashmap__t2SR9Ast__id_t(
   struct _fx_R9Ast__id_t* n_id_0,
   fx_str_t* prefix_0,
   fx_str_t* name_0,
   fx_str_t* suffix_0,
   struct _fx_Nt10Hashmap__t2SR9Ast__id_t_data_t* mangle_map_0,
   struct _fx_Ta2S* fx_result,
   void* fx_fv)
{
   int fx_status = 0;
   FX_CALL(
      _fx_M8K_mangleFM12make_unique_Ta2S6iNt10Hashmap__t2SR9Ast__id_tR9Ast__id_tSSS(0, mangle_map_0, n_id_0, name_0, prefix_0,
         suffix_0, fx_result, 0), _fx_cleanup);

_fx_cleanup: ;
   return fx_status;
}

static int _fx_M8K_mangleFM12make_unique_Ta2S6iNt10Hashmap__t2SR9Ast__id_tR9Ast__id_tSSS(
   int_ idx_0,
   struct _fx_Nt10Hashmap__t2SR9Ast__id_t_data_t* mangle_map_0,
   struct _fx_R9Ast__id_t* n_id_0,
   fx_str_t* name_0,
   fx_str_t* prefix_0,
   fx_str_t* suffix_0,
   struct _fx_Ta2S* fx_result,
   void* fx_fv)
{
   _fx_Ta2S result_0 = {0};
   int fx_status = 0;
   int_ idx_1 = idx_0;
   for (;;) {
      fx_str_t idxstr_0 = {0};
      fx_str_t v_0 = {0};
      fx_str_t name1_0 = {0};
      fx_str_t v_1 = {0};
      fx_str_t candidate_base_name_0 = {0};
      fx_str_t candidate_0 = {0};
      _fx_Ta2S result_1 = {0};
      int_ idx_2 = idx_1;
      if (idx_2 == 0) {
         fx_str_t slit_0 = FX_MAKE_STR(""); fx_copy_str(&slit_0, &idxstr_0);
      }
      else {
         FX_CALL(_fx_F6stringS1i(idx_2, &v_0, 0), _fx_catch_0);
         fx_str_t slit_1 = FX_MAKE_STR("_");
         {
            const fx_str_t strs_0[] = { v_0, slit_1 };
            FX_CALL(fx_strjoin(0, 0, 0, strs_0, 2, &idxstr_0), _fx_catch_0);
         }
      }
      {
         const fx_str_t strs_1[] = { *name_0, idxstr_0 };
         FX_CALL(fx_strjoin(0, 0, 0, strs_1, 2, &name1_0), _fx_catch_0);
      }
      int_ nlen_0 = FX_STR_LENGTH(name1_0);
      FX_CALL(_fx_F6stringS1i(nlen_0, &v_1, 0), _fx_catch_0);
      {
         const fx_str_t strs_2[] = { *prefix_0, v_1, name1_0 };
         FX_CALL(fx_strjoin(0, 0, 0, strs_2, 3, &candidate_base_name_0), _fx_catch_0);
      }
      {
         const fx_str_t strs_3[] = { candidate_base_name_0, *suffix_0 };
         FX_CALL(fx_strjoin(0, 0, 0, strs_3, 2, &candidate_0), _fx_catch_0);
      }
      _fx_Ta2i v_2;
      FX_CALL(_fx_M8K_mangleFM9find_idx_Ta2i2Nt10Hashmap__t2SR9Ast__id_tS(mangle_map_0, &candidate_0, &v_2, 0), _fx_catch_0);
      if (v_2.t1 >= 0) {
         idx_1 = idx_2 + 1;
      }
      else {
         int_ idx_3;
         FX_CALL(_fx_M8K_mangleFM18find_idx_or_inserti2Nt10Hashmap__t2SR9Ast__id_tS(mangle_map_0, &candidate_0, &idx_3, 0),
            _fx_catch_0);
         FX_CHKIDX(FX_CHKIDX1(mangle_map_0->u.t.t5, 0, idx_3), _fx_catch_0);
         FX_PTR_1D(_fx_Rt20Hashmap__hashentry_t2SR9Ast__id_t, mangle_map_0->u.t.t5, idx_3)->data = *n_id_0;
         _fx_make_Ta2S(&candidate_base_name_0, &candidate_0, &result_1);
         _fx_free_Ta2S(&result_0);
         _fx_copy_Ta2S(&result_1, &result_0);
         FX_BREAK(_fx_catch_0);
      }

   _fx_catch_0: ;
      _fx_free_Ta2S(&result_1);
      FX_FREE_STR(&candidate_0);
      FX_FREE_STR(&candidate_base_name_0);
      FX_FREE_STR(&v_1);
      FX_FREE_STR(&name1_0);
      FX_FREE_STR(&v_0);
      FX_FREE_STR(&idxstr_0);
      FX_CHECK_BREAK();
      FX_CHECK_EXN(_fx_cleanup);
   }
   _fx_copy_Ta2S(&result_0, fx_result);

_fx_cleanup: ;
   _fx_free_Ta2S(&result_0);
   return fx_status;
}

FX_EXTERN_C int _fx_M8K_mangleFM6add_fxS1S(fx_str_t* str_0, fx_str_t* fx_result, void* fx_fv)
{
   int fx_status = 0;
   bool v_0;
   fx_str_t slit_0 = FX_MAKE_STR("_fx_");
   v_0 = _fx_M6StringFM10startswithB2SS(str_0, &slit_0, 0);
   if (v_0) {
      fx_copy_str(str_0, fx_result);
   }
   else {
      fx_str_t slit_1 = FX_MAKE_STR("_fx_");
      {
         const fx_str_t strs_0[] = { slit_1, *str_0 };
         FX_CALL(fx_strjoin(0, 0, 0, strs_0, 2, fx_result), _fx_cleanup);
      }
   }

_fx_cleanup: ;
   return fx_status;
}

FX_EXTERN_C int _fx_M8K_mangleFM9remove_fxS1S(fx_str_t* str_0, fx_str_t* fx_result, void* fx_fv)
{
   int fx_status = 0;
   bool v_0;
   fx_str_t slit_0 = FX_MAKE_STR("_fx_");
   v_0 = _fx_M6StringFM10startswithB2SS(str_0, &slit_0, 0);
   if (v_0) {
      FX_CALL(fx_substr(str_0, 4, 0, 1, 2, fx_result), _fx_cleanup);
   }
   else {
      fx_copy_str(str_0, fx_result);
   }

_fx_cleanup: ;
   return fx_status;
}

FX_EXTERN_C int _fx_M8K_mangleFM11mangle_ktypS3N14K_form__ktyp_tNt10Hashmap__t2SR9Ast__id_tR10Ast__loc_t(
   struct _fx_N14K_form__ktyp_t_data_t* t_0,
   struct _fx_Nt10Hashmap__t2SR9Ast__id_t_data_t* mangle_map_0,
   struct _fx_R10Ast__loc_t* loc_0,
   fx_str_t* fx_result,
   void* fx_fv)
{
   _fx_LS v_0 = 0;
   _fx_LS v_1 = 0;
   int fx_status = 0;
   FX_CALL(
      _fx_M8K_mangleFM12mangle_ktyp_LS4N14K_form__ktyp_tLSR10Ast__loc_tNt10Hashmap__t2SR9Ast__id_t(t_0, 0, loc_0, mangle_map_0,
         &v_0, 0), _fx_cleanup);
   FX_CALL(_fx_M8K_mangleFM3revLS1LS(v_0, &v_1, 0), _fx_cleanup);
   fx_str_t slit_0 = FX_MAKE_STR("");
   FX_CALL(_fx_M8K_mangleFM4joinS2SLS(&slit_0, v_1, fx_result, 0), _fx_cleanup);

_fx_cleanup: ;
   if (v_0) {
      _fx_free_LS(&v_0);
   }
   if (v_1) {
      _fx_free_LS(&v_1);
   }
   return fx_status;
}

static int
   _fx_M8K_mangleFM12mangle_inst_Ta2S7R9Ast__id_tSLN14K_form__ktyp_tR9Ast__id_tLN12Ast__scope_tR10Ast__loc_tNt10Hashmap__t2SR9Ast__id_t(
   struct _fx_R9Ast__id_t* n_id_0,
   fx_str_t* prefix_0,
   struct _fx_LN14K_form__ktyp_t_data_t* targs_0,
   struct _fx_R9Ast__id_t* name_0,
   struct _fx_LN12Ast__scope_t_data_t* sc_0,
   struct _fx_R10Ast__loc_t* loc_0,
   struct _fx_Nt10Hashmap__t2SR9Ast__id_t_data_t* mangle_map_0,
   struct _fx_Ta2S* fx_result,
   void* fx_fv)
{
   _fx_LS __fold_result___0 = 0;
   _fx_LS result_0 = 0;
   _fx_Ta2S v_0 = {0};
   fx_str_t v_1 = {0};
   fx_str_t v_2 = {0};
   _fx_LS __fold_result___1 = 0;
   _fx_LS v_3 = 0;
   fx_str_t v_4 = {0};
   fx_str_t v_5 = {0};
   fx_str_t prefix_1 = {0};
   fx_str_t suffix_0 = {0};
   _fx_Nt6option1LN12Ast__scope_t v_6 = {0};
   _fx_LN12Ast__scope_t sc_1 = 0;
   fx_str_t prefix_2 = {0};
   fx_str_t nstr_0 = {0};
   fx_str_t name_1 = {0};
   _fx_Ta2S v_7 = {0};
   fx_str_t mangled_basename_0 = {0};
   fx_str_t mangled_name_0 = {0};
   int fx_status = 0;
   FX_CALL(fx_check_stack(), _fx_cleanup);
   int_ nargs_0 = _fx_M8K_mangleFM6lengthi1LN14K_form__ktyp_t(targs_0, 0);
   _fx_LN14K_form__ktyp_t lst_0 = targs_0;
   for (; lst_0; lst_0 = lst_0->tl) {
      _fx_LS result_1 = 0;
      _fx_LS v_8 = 0;
      _fx_N14K_form__ktyp_t targ_0 = lst_0->hd;
      FX_COPY_PTR(__fold_result___0, &result_1);
      FX_CALL(
         _fx_M8K_mangleFM12mangle_ktyp_LS4N14K_form__ktyp_tLSR10Ast__loc_tNt10Hashmap__t2SR9Ast__id_t(targ_0, result_1, loc_0,
            mangle_map_0, &v_8, 0), _fx_catch_0);
      _fx_free_LS(&__fold_result___0);
      FX_COPY_PTR(v_8, &__fold_result___0);

   _fx_catch_0: ;
      if (v_8) {
         _fx_free_LS(&v_8);
      }
      if (result_1) {
         _fx_free_LS(&result_1);
      }
      FX_CHECK_EXN(_fx_cleanup);
   }
   FX_COPY_PTR(__fold_result___0, &result_0);
   if (nargs_0 == 0) {
      fx_str_t slit_0 = FX_MAKE_STR(""); _fx_make_Ta2S(prefix_0, &slit_0, &v_0);
   }
   else {
      fx_str_t slit_1 = FX_MAKE_STR("t");
      {
         const fx_str_t strs_0[] = { *prefix_0, slit_1 };
         FX_CALL(fx_strjoin(0, 0, 0, strs_0, 2, &v_1), _fx_cleanup);
      }
      FX_CALL(_fx_F6stringS1i(nargs_0, &v_2, 0), _fx_cleanup);
      _fx_LS lst_1 = result_0;
      for (; lst_1; lst_1 = lst_1->tl) {
         _fx_LS r_0 = 0;
         fx_str_t* a_0 = &lst_1->hd;
         FX_COPY_PTR(__fold_result___1, &r_0);
         FX_CALL(_fx_cons_LS(a_0, r_0, false, &r_0), _fx_catch_1);
         _fx_free_LS(&__fold_result___1);
         FX_COPY_PTR(r_0, &__fold_result___1);

      _fx_catch_1: ;
         if (r_0) {
            _fx_free_LS(&r_0);
         }
         FX_CHECK_EXN(_fx_cleanup);
      }
      FX_COPY_PTR(__fold_result___1, &v_3);
      fx_str_t slit_2 = FX_MAKE_STR("");
      FX_CALL(_fx_F4joinS2SLS(&slit_2, v_3, &v_4, 0), _fx_cleanup);
      {
         const fx_str_t strs_1[] = { v_2, v_4 };
         FX_CALL(fx_strjoin(0, 0, 0, strs_1, 2, &v_5), _fx_cleanup);
      }
      _fx_make_Ta2S(&v_1, &v_5, &v_0);
   }
   fx_copy_str(&v_0.t0, &prefix_1);
   fx_copy_str(&v_0.t1, &suffix_0);
   _fx_M8K_mangleFM4SomeNt6option1LN12Ast__scope_t1LN12Ast__scope_t(sc_0, &v_6);
   if (v_6.tag == 2) {
      FX_COPY_PTR(v_6.u.Some, &sc_1);
   }
   else {
      _fx_N15K_form__kinfo_t v_9 = {0};
      FX_CALL(_fx_M6K_formFM6kinfo_N15K_form__kinfo_t2R9Ast__id_tR10Ast__loc_t(name_0, loc_0, &v_9, 0), _fx_catch_2);
      FX_CALL(_fx_M6K_formFM10get_kscopeLN12Ast__scope_t1N15K_form__kinfo_t(&v_9, &sc_1, 0), _fx_catch_2);

   _fx_catch_2: ;
      _fx_free_N15K_form__kinfo_t(&v_9);
   }
   FX_CHECK_EXN(_fx_cleanup);
   fx_str_t slit_3 = FX_MAKE_STR("");
   FX_CALL(_fx_M8K_mangleFM12mangle_scopeS3LN12Ast__scope_tSR10Ast__loc_t(sc_1, &slit_3, loc_0, &prefix_2, 0), _fx_cleanup);
   FX_CALL(_fx_M3AstFM2ppS1RM4id_t(name_0, &nstr_0, 0), _fx_cleanup);
   if (FX_STR_LENGTH(prefix_2) == 0) {
      fx_copy_str(&nstr_0, &name_1);
   }
   else {
      fx_str_t slit_4 = FX_MAKE_STR("__");
      {
         const fx_str_t strs_2[] = { prefix_2, slit_4, nstr_0 };
         FX_CALL(fx_strjoin(0, 0, 0, strs_2, 3, &name_1), _fx_cleanup);
      }
   }
   FX_CALL(
      _fx_M8K_mangleFM18mangle_make_uniqueTa2S5R9Ast__id_tSSSNt10Hashmap__t2SR9Ast__id_t(n_id_0, &prefix_1, &name_1, &suffix_0,
         mangle_map_0, &v_7, 0), _fx_cleanup);
   fx_copy_str(&v_7.t0, &mangled_basename_0);
   fx_copy_str(&v_7.t1, &mangled_name_0);
   _fx_make_Ta2S(&mangled_basename_0, &mangled_name_0, fx_result);

_fx_cleanup: ;
   if (__fold_result___0) {
      _fx_free_LS(&__fold_result___0);
   }
   if (result_0) {
      _fx_free_LS(&result_0);
   }
   _fx_free_Ta2S(&v_0);
   FX_FREE_STR(&v_1);
   FX_FREE_STR(&v_2);
   if (__fold_result___1) {
      _fx_free_LS(&__fold_result___1);
   }
   if (v_3) {
      _fx_free_LS(&v_3);
   }
   FX_FREE_STR(&v_4);
   FX_FREE_STR(&v_5);
   FX_FREE_STR(&prefix_1);
   FX_FREE_STR(&suffix_0);
   _fx_free_Nt6option1LN12Ast__scope_t(&v_6);
   FX_FREE_LIST_SIMPLE(&sc_1);
   FX_FREE_STR(&prefix_2);
   FX_FREE_STR(&nstr_0);
   FX_FREE_STR(&name_1);
   _fx_free_Ta2S(&v_7);
   FX_FREE_STR(&mangled_basename_0);
   FX_FREE_STR(&mangled_name_0);
   return fx_status;
}

static int _fx_M8K_mangleFM15mangle_typname_LS4R9Ast__id_tLSR10Ast__loc_tNt10Hashmap__t2SR9Ast__id_t(
   struct _fx_R9Ast__id_t* n_0,
   struct _fx_LS_data_t* result_0,
   struct _fx_R10Ast__loc_t* loc_0,
   struct _fx_Nt10Hashmap__t2SR9Ast__id_t_data_t* mangle_map_0,
   struct _fx_LS_data_t** fx_result,
   void* fx_fv)
{
   _fx_N15K_form__kinfo_t v_0 = {0};
   _fx_R17K_form__kdeftyp_t v_1 = {0};
   int fx_status = 0;
   FX_CALL(fx_check_stack(), _fx_cleanup);
   FX_CALL(_fx_M6K_formFM6kinfo_N15K_form__kinfo_t2R9Ast__id_tR10Ast__loc_t(n_0, loc_0, &v_0, 0), _fx_cleanup);
   int tag_0 = v_0.tag;
   if (tag_0 == 5) {
      _fx_LN12Ast__scope_t kvar_scope_0 = 0;
      _fx_LN14K_form__ktyp_t kvar_targs_0 = 0;
      fx_str_t kvar_cname_0 = {0};
      fx_str_t cname_0 = {0};
      _fx_LS res_0 = 0;
      _fx_N15K_form__kinfo_t v_2 = {0};
      _fx_Ta2S v_3 = {0};
      fx_str_t v_4 = {0};
      _fx_R21K_form__kdefvariant_t v_5 = {0};
      fx_str_t v_6 = {0};
      _fx_rR21K_form__kdefvariant_t kvar_0 = v_0.u.KVariant;
      _fx_R21K_form__kdefvariant_t* v_7 = &kvar_0->data;
      _fx_R10Ast__loc_t kvar_loc_0 = v_7->kvar_loc;
      FX_COPY_PTR(v_7->kvar_scope, &kvar_scope_0);
      FX_COPY_PTR(v_7->kvar_targs, &kvar_targs_0);
      _fx_R9Ast__id_t kvar_proto_0 = v_7->kvar_proto;
      fx_copy_str(&v_7->kvar_cname, &kvar_cname_0);
      _fx_R9Ast__id_t kvar_name_0 = v_7->kvar_name;
      if (FX_STR_LENGTH(kvar_cname_0) == 0) {
         bool res_1;
         FX_CALL(_fx_M3AstFM6__eq__B2RM4id_tRM4id_t(&kvar_proto_0, &_fx_g9Ast__noid, &res_1, 0), _fx_catch_2);
         if (!res_1) {
            FX_CALL(
               _fx_M8K_mangleFM15mangle_typname_LS4R9Ast__id_tLSR10Ast__loc_tNt10Hashmap__t2SR9Ast__id_t(&kvar_proto_0, 0,
                  loc_0, mangle_map_0, &res_0, 0), _fx_catch_2);
            FX_CALL(_fx_M6K_formFM6kinfo_N15K_form__kinfo_t2R9Ast__id_tR10Ast__loc_t(&kvar_proto_0, &kvar_loc_0, &v_2, 0),
               _fx_catch_2);
            if (v_2.tag == 5) {
               _fx_R21K_form__kdefvariant_t v_8 = {0};
               _fx_copy_R21K_form__kdefvariant_t(&v_2.u.KVariant->data, &v_8);
               fx_str_t* kvar_cname_1 = &v_8.kvar_cname;
               bool v_9;
               fx_str_t slit_0 = FX_MAKE_STR("_fx_");
               v_9 = _fx_M6StringFM10startswithB2SS(kvar_cname_1, &slit_0, 0);
               if (v_9) {
                  FX_CALL(fx_substr(kvar_cname_1, 4, 0, 1, 2, &cname_0), _fx_catch_0);
               }
               else {
                  fx_copy_str(kvar_cname_1, &cname_0);
               }

            _fx_catch_0: ;
               _fx_free_R21K_form__kdefvariant_t(&v_8);
            }
            else {
               fx_exn_t v_10 = {0};
               fx_str_t slit_1 = FX_MAKE_STR("kvar_proto must be a variant");
               FX_CALL(_fx_M3AstFM11compile_errE2RM5loc_tS(&kvar_loc_0, &slit_1, &v_10, 0), _fx_catch_1);
               FX_THROW(&v_10, false, _fx_catch_1);

            _fx_catch_1: ;
               fx_free_exn(&v_10);
            }
            FX_CHECK_EXN(_fx_catch_2);
         }
         else {
            fx_str_t slit_2 = FX_MAKE_STR("N");
            FX_CALL(
               _fx_M8K_mangleFM12mangle_inst_Ta2S7R9Ast__id_tSLN14K_form__ktyp_tR9Ast__id_tLN12Ast__scope_tR10Ast__loc_tNt10Hashmap__t2SR9Ast__id_t(
                  &kvar_name_0, &slit_2, kvar_targs_0, &kvar_name_0, kvar_scope_0, loc_0, mangle_map_0, &v_3, 0), _fx_catch_2);
            fx_copy_str(&v_3.t1, &cname_0);
         }
         _fx_R21K_form__kdefvariant_t* v_11 = &kvar_0->data;
         bool v_12;
         fx_str_t slit_3 = FX_MAKE_STR("_fx_");
         v_12 = _fx_M6StringFM10startswithB2SS(&cname_0, &slit_3, 0);
         if (v_12) {
            fx_copy_str(&cname_0, &v_4);
         }
         else {
            fx_str_t slit_4 = FX_MAKE_STR("_fx_");
            {
               const fx_str_t strs_0[] = { slit_4, cname_0 };
               FX_CALL(fx_strjoin(0, 0, 0, strs_0, 2, &v_4), _fx_catch_2);
            }
         }
         _fx_make_R21K_form__kdefvariant_t(&v_11->kvar_name, &v_4, &v_11->kvar_proto, &v_11->kvar_props, v_11->kvar_targs,
            v_11->kvar_cases, v_11->kvar_ctors, &v_11->kvar_flags, v_11->kvar_ifaces, v_11->kvar_scope, &v_11->kvar_loc, &v_5);
         _fx_R21K_form__kdefvariant_t* v_13 = &kvar_0->data;
         _fx_free_R21K_form__kdefvariant_t(v_13);
         _fx_copy_R21K_form__kdefvariant_t(&v_5, v_13);
         FX_CALL(_fx_cons_LS(&cname_0, result_0, true, fx_result), _fx_catch_2);
      }
      else {
         bool v_14;
         fx_str_t slit_5 = FX_MAKE_STR("_fx_");
         v_14 = _fx_M6StringFM10startswithB2SS(&kvar_cname_0, &slit_5, 0);
         if (v_14) {
            FX_CALL(fx_substr(&kvar_cname_0, 4, 0, 1, 2, &v_6), _fx_catch_2);
         }
         else {
            fx_copy_str(&kvar_cname_0, &v_6);
         }
         FX_CALL(_fx_cons_LS(&v_6, result_0, true, fx_result), _fx_catch_2);
      }

   _fx_catch_2: ;
      FX_FREE_STR(&v_6);
      _fx_free_R21K_form__kdefvariant_t(&v_5);
      FX_FREE_STR(&v_4);
      _fx_free_Ta2S(&v_3);
      _fx_free_N15K_form__kinfo_t(&v_2);
      if (res_0) {
         _fx_free_LS(&res_0);
      }
      FX_FREE_STR(&cname_0);
      FX_FREE_STR(&kvar_cname_0);
      if (kvar_targs_0) {
         _fx_free_LN14K_form__ktyp_t(&kvar_targs_0);
      }
      FX_FREE_LIST_SIMPLE(&kvar_scope_0);
      goto _fx_endmatch_1;
   }
   if (tag_0 == 8) {
      _fx_rR17K_form__kdeftyp_t kt_0 = v_0.u.KTyp;
      _fx_copy_R17K_form__kdeftyp_t(&kt_0->data, &v_1);
      if (FX_REC_VARIANT_TAG(v_1.kt_typ) == 15) {
         _fx_LN12Ast__scope_t kt_scope_0 = 0;
         _fx_LN14K_form__ktyp_t kt_targs_0 = 0;
         fx_str_t kt_cname_0 = {0};
         fx_str_t cname_1 = {0};
         _fx_LS res_2 = 0;
         _fx_N15K_form__kinfo_t v_15 = {0};
         _fx_R17K_form__kdeftyp_t v_16 = {0};
         _fx_Ta2S v_17 = {0};
         fx_str_t v_18 = {0};
         _fx_R17K_form__kdeftyp_t v_19 = {0};
         fx_str_t v_20 = {0};
         _fx_R17K_form__kdeftyp_t* v_21 = &kt_0->data;
         _fx_R10Ast__loc_t kt_loc_0 = v_21->kt_loc;
         FX_COPY_PTR(v_21->kt_scope, &kt_scope_0);
         FX_COPY_PTR(v_21->kt_targs, &kt_targs_0);
         _fx_R9Ast__id_t kt_proto_0 = v_21->kt_proto;
         fx_copy_str(&v_21->kt_cname, &kt_cname_0);
         _fx_R9Ast__id_t kt_name_0 = v_21->kt_name;
         if (FX_STR_LENGTH(kt_cname_0) == 0) {
            bool res_3;
            FX_CALL(_fx_M3AstFM6__eq__B2RM4id_tRM4id_t(&kt_proto_0, &_fx_g9Ast__noid, &res_3, 0), _fx_catch_5);
            if (!res_3) {
               FX_CALL(
                  _fx_M8K_mangleFM15mangle_typname_LS4R9Ast__id_tLSR10Ast__loc_tNt10Hashmap__t2SR9Ast__id_t(&kt_proto_0, 0,
                     loc_0, mangle_map_0, &res_2, 0), _fx_catch_5);
               FX_CALL(_fx_M6K_formFM6kinfo_N15K_form__kinfo_t2R9Ast__id_tR10Ast__loc_t(&kt_proto_0, &kt_loc_0, &v_15, 0),
                  _fx_catch_5);
               if (v_15.tag == 8) {
                  _fx_copy_R17K_form__kdeftyp_t(&v_15.u.KTyp->data, &v_16);
                  if (FX_REC_VARIANT_TAG(v_16.kt_typ) == 15) {
                     fx_str_t* kt_cname_1 = &v_16.kt_cname;
                     bool v_22;
                     fx_str_t slit_6 = FX_MAKE_STR("_fx_");
                     v_22 = _fx_M6StringFM10startswithB2SS(kt_cname_1, &slit_6, 0);
                     if (v_22) {
                        FX_CALL(fx_substr(kt_cname_1, 4, 0, 1, 2, &cname_1), _fx_catch_3);
                     }
                     else {
                        fx_copy_str(kt_cname_1, &cname_1);
                     }

                  _fx_catch_3: ;
                     goto _fx_endmatch_0;
                  }
               }
               fx_exn_t v_23 = {0};
               fx_str_t slit_7 = FX_MAKE_STR("kt_proto must be a type (record) definition");
               FX_CALL(_fx_M3AstFM11compile_errE2RM5loc_tS(&kt_loc_0, &slit_7, &v_23, 0), _fx_catch_4);
               FX_THROW(&v_23, false, _fx_catch_4);

            _fx_catch_4: ;
               fx_free_exn(&v_23);

            _fx_endmatch_0: ;
               FX_CHECK_EXN(_fx_catch_5);
            }
            else {
               fx_str_t slit_8 = FX_MAKE_STR("R");
               FX_CALL(
                  _fx_M8K_mangleFM12mangle_inst_Ta2S7R9Ast__id_tSLN14K_form__ktyp_tR9Ast__id_tLN12Ast__scope_tR10Ast__loc_tNt10Hashmap__t2SR9Ast__id_t(
                     &kt_name_0, &slit_8, kt_targs_0, &kt_name_0, kt_scope_0, loc_0, mangle_map_0, &v_17, 0), _fx_catch_5);
               fx_copy_str(&v_17.t1, &cname_1);
            }
            _fx_R17K_form__kdeftyp_t* v_24 = &kt_0->data;
            bool v_25;
            fx_str_t slit_9 = FX_MAKE_STR("_fx_");
            v_25 = _fx_M6StringFM10startswithB2SS(&cname_1, &slit_9, 0);
            if (v_25) {
               fx_copy_str(&cname_1, &v_18);
            }
            else {
               fx_str_t slit_10 = FX_MAKE_STR("_fx_");
               {
                  const fx_str_t strs_1[] = { slit_10, cname_1 };
                  FX_CALL(fx_strjoin(0, 0, 0, strs_1, 2, &v_18), _fx_catch_5);
               }
            }
            _fx_make_R17K_form__kdeftyp_t(&v_24->kt_name, &v_18, &v_24->kt_proto, &v_24->kt_props, v_24->kt_targs, v_24->kt_typ,
               v_24->kt_scope, &v_24->kt_loc, &v_19);
            _fx_R17K_form__kdeftyp_t* v_26 = &kt_0->data;
            _fx_free_R17K_form__kdeftyp_t(v_26);
            _fx_copy_R17K_form__kdeftyp_t(&v_19, v_26);
            FX_CALL(_fx_cons_LS(&cname_1, result_0, true, fx_result), _fx_catch_5);
         }
         else {
            bool v_27;
            fx_str_t slit_11 = FX_MAKE_STR("_fx_");
            v_27 = _fx_M6StringFM10startswithB2SS(&kt_cname_0, &slit_11, 0);
            if (v_27) {
               FX_CALL(fx_substr(&kt_cname_0, 4, 0, 1, 2, &v_20), _fx_catch_5);
            }
            else {
               fx_copy_str(&kt_cname_0, &v_20);
            }
            FX_CALL(_fx_cons_LS(&v_20, result_0, true, fx_result), _fx_catch_5);
         }

      _fx_catch_5: ;
         FX_FREE_STR(&v_20);
         _fx_free_R17K_form__kdeftyp_t(&v_19);
         FX_FREE_STR(&v_18);
         _fx_free_Ta2S(&v_17);
         _fx_free_R17K_form__kdeftyp_t(&v_16);
         _fx_free_N15K_form__kinfo_t(&v_15);
         if (res_2) {
            _fx_free_LS(&res_2);
         }
         FX_FREE_STR(&cname_1);
         FX_FREE_STR(&kt_cname_0);
         if (kt_targs_0) {
            _fx_free_LN14K_form__ktyp_t(&kt_targs_0);
         }
         FX_FREE_LIST_SIMPLE(&kt_scope_0);
         goto _fx_endmatch_1;
      }
   }
   if (tag_0 == 8) {
      _fx_R17K_form__kdeftyp_t v_28 = {0};
      fx_exn_t v_29 = {0};
      fx_str_t v_30 = {0};
      _fx_copy_R17K_form__kdeftyp_t(&v_0.u.KTyp->data, &v_28);
      fx_str_t* kt_cname_2 = &v_28.kt_cname;
      if (FX_STR_LENGTH(*kt_cname_2) == 0) {
         fx_str_t slit_12 = FX_MAKE_STR("KTyp does not have a proper mangled name");
         FX_CALL(_fx_M3AstFM11compile_errE2RM5loc_tS(loc_0, &slit_12, &v_29, 0), _fx_catch_6);
         FX_THROW(&v_29, false, _fx_catch_6);
      }
      else {
         bool v_31;
         fx_str_t slit_13 = FX_MAKE_STR("_fx_");
         v_31 = _fx_M6StringFM10startswithB2SS(kt_cname_2, &slit_13, 0);
         if (v_31) {
            FX_CALL(fx_substr(kt_cname_2, 4, 0, 1, 2, &v_30), _fx_catch_6);
         }
         else {
            fx_copy_str(kt_cname_2, &v_30);
         }
         FX_CALL(_fx_cons_LS(&v_30, result_0, true, fx_result), _fx_catch_6);
      }

   _fx_catch_6: ;
      FX_FREE_STR(&v_30);
      fx_free_exn(&v_29);
      _fx_free_R17K_form__kdeftyp_t(&v_28);
      goto _fx_endmatch_1;
   }
   if (tag_0 == 7) {
      _fx_LN12Ast__scope_t ki_scope_0 = 0;
      fx_str_t ki_cname_0 = {0};
      _fx_Ta2S v_32 = {0};
      fx_str_t cname_2 = {0};
      fx_str_t v_33 = {0};
      _fx_R23K_form__kdefinterface_t v_34 = {0};
      _fx_R17K_form__kdefval_t kv_0 = {0};
      fx_str_t v_35 = {0};
      _fx_R17K_form__kdefval_t v_36 = {0};
      _fx_N15K_form__kinfo_t v_37 = {0};
      fx_str_t v_38 = {0};
      _fx_rR23K_form__kdefinterface_t ki_0 = v_0.u.KInterface;
      _fx_R23K_form__kdefinterface_t* v_39 = &ki_0->data;
      _fx_R10Ast__loc_t ki_loc_0 = v_39->ki_loc;
      FX_COPY_PTR(v_39->ki_scope, &ki_scope_0);
      _fx_R9Ast__id_t ki_id_0 = v_39->ki_id;
      fx_copy_str(&v_39->ki_cname, &ki_cname_0);
      _fx_R9Ast__id_t ki_name_0 = v_39->ki_name;
      if (FX_STR_LENGTH(ki_cname_0) == 0) {
         fx_str_t slit_14 = FX_MAKE_STR("I");
         FX_CALL(
            _fx_M8K_mangleFM12mangle_inst_Ta2S7R9Ast__id_tSLN14K_form__ktyp_tR9Ast__id_tLN12Ast__scope_tR10Ast__loc_tNt10Hashmap__t2SR9Ast__id_t(
               &ki_name_0, &slit_14, 0, &ki_name_0, ki_scope_0, loc_0, mangle_map_0, &v_32, 0), _fx_catch_7);
         fx_copy_str(&v_32.t1, &cname_2);
         _fx_R23K_form__kdefinterface_t* v_40 = &ki_0->data;
         bool v_41;
         fx_str_t slit_15 = FX_MAKE_STR("_fx_");
         v_41 = _fx_M6StringFM10startswithB2SS(&cname_2, &slit_15, 0);
         if (v_41) {
            fx_copy_str(&cname_2, &v_33);
         }
         else {
            fx_str_t slit_16 = FX_MAKE_STR("_fx_");
            {
               const fx_str_t strs_2[] = { slit_16, cname_2 };
               FX_CALL(fx_strjoin(0, 0, 0, strs_2, 2, &v_33), _fx_catch_7);
            }
         }
         _fx_make_R23K_form__kdefinterface_t(&v_40->ki_name, &v_40->ki_base, &v_33, &v_40->ki_id, v_40->ki_all_methods,
            v_40->ki_scope, &v_40->ki_loc, &v_34);
         _fx_R23K_form__kdefinterface_t* v_42 = &ki_0->data;
         _fx_free_R23K_form__kdefinterface_t(v_42);
         _fx_copy_R23K_form__kdefinterface_t(&v_34, v_42);
         FX_CALL(_fx_M6K_formFM8get_kvalRM9kdefval_t2R9Ast__id_tR10Ast__loc_t(&ki_id_0, &ki_loc_0, &kv_0, 0), _fx_catch_7);
         fx_str_t slit_17 = FX_MAKE_STR("_FX_");
         fx_str_t slit_18 = FX_MAKE_STR("_id");
         {
            const fx_str_t strs_3[] = { slit_17, cname_2, slit_18 };
            FX_CALL(fx_strjoin(0, 0, 0, strs_3, 3, &v_35), _fx_catch_7);
         }
         _fx_make_R17K_form__kdefval_t(&kv_0.kv_name, &v_35, kv_0.kv_typ, &kv_0.kv_flags, &kv_0.kv_loc, &v_36);
         _fx_M6K_formFM4KValN15K_form__kinfo_t1RM9kdefval_t(&v_36, &v_37);
         FX_CALL(_fx_M6K_formFM13set_idk_entryv2R9Ast__id_tN15K_form__kinfo_t(&ki_id_0, &v_37, 0), _fx_catch_7);
         FX_CALL(_fx_cons_LS(&cname_2, result_0, true, fx_result), _fx_catch_7);
      }
      else {
         bool v_43;
         fx_str_t slit_19 = FX_MAKE_STR("_fx_");
         v_43 = _fx_M6StringFM10startswithB2SS(&ki_cname_0, &slit_19, 0);
         if (v_43) {
            FX_CALL(fx_substr(&ki_cname_0, 4, 0, 1, 2, &v_38), _fx_catch_7);
         }
         else {
            fx_copy_str(&ki_cname_0, &v_38);
         }
         FX_CALL(_fx_cons_LS(&v_38, result_0, true, fx_result), _fx_catch_7);
      }

   _fx_catch_7: ;
      FX_FREE_STR(&v_38);
      _fx_free_N15K_form__kinfo_t(&v_37);
      _fx_free_R17K_form__kdefval_t(&v_36);
      FX_FREE_STR(&v_35);
      _fx_free_R17K_form__kdefval_t(&kv_0);
      _fx_free_R23K_form__kdefinterface_t(&v_34);
      FX_FREE_STR(&v_33);
      FX_FREE_STR(&cname_2);
      _fx_free_Ta2S(&v_32);
      FX_FREE_STR(&ki_cname_0);
      FX_FREE_LIST_SIMPLE(&ki_scope_0);
      goto _fx_endmatch_1;
   }
   fx_str_t v_44 = {0};
   fx_str_t v_45 = {0};
   fx_exn_t v_46 = {0};
   FX_CALL(_fx_M6K_formFM7idk2strS2R9Ast__id_tR10Ast__loc_t(n_0, loc_0, &v_44, 0), _fx_catch_8);
   fx_str_t slit_20 = FX_MAKE_STR("unsupported type \'");
   fx_str_t slit_21 = FX_MAKE_STR("\' (should be variant or record)");
   {
      const fx_str_t strs_4[] = { slit_20, v_44, slit_21 };
      FX_CALL(fx_strjoin(0, 0, 0, strs_4, 3, &v_45), _fx_catch_8);
   }
   FX_CALL(_fx_M3AstFM11compile_errE2RM5loc_tS(loc_0, &v_45, &v_46, 0), _fx_catch_8);
   FX_THROW(&v_46, false, _fx_catch_8);

_fx_catch_8: ;
   fx_free_exn(&v_46);
   FX_FREE_STR(&v_45);
   FX_FREE_STR(&v_44);

_fx_endmatch_1: ;

_fx_cleanup: ;
   _fx_free_N15K_form__kinfo_t(&v_0);
   _fx_free_R17K_form__kdeftyp_t(&v_1);
   return fx_status;
}

static int _fx_M8K_mangleFM12mangle_ktyp_LS4N14K_form__ktyp_tLSR10Ast__loc_tNt10Hashmap__t2SR9Ast__id_t(
   struct _fx_N14K_form__ktyp_t_data_t* t_0,
   struct _fx_LS_data_t* result_0,
   struct _fx_R10Ast__loc_t* loc_0,
   struct _fx_Nt10Hashmap__t2SR9Ast__id_t_data_t* mangle_map_0,
   struct _fx_LS_data_t** fx_result,
   void* fx_fv)
{
   _fx_LS result_1 = 0;
   _fx_N14K_form__ktyp_t t_1 = 0;
   _fx_LS result_2 = 0;
   int fx_status = 0;
   FX_CALL(fx_check_stack(), _fx_cleanup);
   FX_COPY_PTR(t_0, &t_1);
   FX_COPY_PTR(result_0, &result_2);
   for (;;) {
      _fx_N14K_form__ktyp_t t_2 = 0;
      _fx_LS result_3 = 0;
      FX_COPY_PTR(t_1, &t_2);
      FX_COPY_PTR(result_2, &result_3);
      int tag_0 = FX_REC_VARIANT_TAG(t_2);
      if (tag_0 == 1) {
         _fx_LS result_4 = 0;
         fx_str_t slit_0 = FX_MAKE_STR("i");
         FX_CALL(_fx_cons_LS(&slit_0, result_3, true, &result_4), _fx_catch_0);
         _fx_free_LS(&result_1);
         FX_COPY_PTR(result_4, &result_1);
         FX_BREAK(_fx_catch_0);

      _fx_catch_0: ;
         if (result_4) {
            _fx_free_LS(&result_4);
         }
         goto _fx_endmatch_0;
      }
      if (tag_0 == 6) {
         _fx_LS result_5 = 0;
         fx_str_t slit_1 = FX_MAKE_STR("g");
         FX_CALL(_fx_cons_LS(&slit_1, result_3, true, &result_5), _fx_catch_1);
         _fx_free_LS(&result_1);
         FX_COPY_PTR(result_5, &result_1);
         FX_BREAK(_fx_catch_1);

      _fx_catch_1: ;
         if (result_5) {
            _fx_free_LS(&result_5);
         }
         goto _fx_endmatch_0;
      }
      if (tag_0 == 3) {
         if (t_2->u.KTypSInt == 8) {
            _fx_LS result_6 = 0;
            fx_str_t slit_2 = FX_MAKE_STR("c");
            FX_CALL(_fx_cons_LS(&slit_2, result_3, true, &result_6), _fx_catch_2);
            _fx_free_LS(&result_1);
            FX_COPY_PTR(result_6, &result_1);
            FX_BREAK(_fx_catch_2);

         _fx_catch_2: ;
            if (result_6) {
               _fx_free_LS(&result_6);
            }
            goto _fx_endmatch_0;
         }
      }
      if (tag_0 == 3) {
         if (t_2->u.KTypSInt == 16) {
            _fx_LS result_7 = 0;
            fx_str_t slit_3 = FX_MAKE_STR("s");
            FX_CALL(_fx_cons_LS(&slit_3, result_3, true, &result_7), _fx_catch_3);
            _fx_free_LS(&result_1);
            FX_COPY_PTR(result_7, &result_1);
            FX_BREAK(_fx_catch_3);

         _fx_catch_3: ;
            if (result_7) {
               _fx_free_LS(&result_7);
            }
            goto _fx_endmatch_0;
         }
      }
      if (tag_0 == 3) {
         if (t_2->u.KTypSInt == 32) {
            _fx_LS result_8 = 0;
            fx_str_t slit_4 = FX_MAKE_STR("n");
            FX_CALL(_fx_cons_LS(&slit_4, result_3, true, &result_8), _fx_catch_4);
            _fx_free_LS(&result_1);
            FX_COPY_PTR(result_8, &result_1);
            FX_BREAK(_fx_catch_4);

         _fx_catch_4: ;
            if (result_8) {
               _fx_free_LS(&result_8);
            }
            goto _fx_endmatch_0;
         }
      }
      if (tag_0 == 2) {
         _fx_LS result_9 = 0;
         fx_str_t slit_5 = FX_MAKE_STR("n");
         FX_CALL(_fx_cons_LS(&slit_5, result_3, true, &result_9), _fx_catch_5);
         _fx_free_LS(&result_1);
         FX_COPY_PTR(result_9, &result_1);
         FX_BREAK(_fx_catch_5);

      _fx_catch_5: ;
         if (result_9) {
            _fx_free_LS(&result_9);
         }
         goto _fx_endmatch_0;
      }
      if (tag_0 == 3) {
         if (t_2->u.KTypSInt == 64) {
            _fx_LS result_10 = 0;
            fx_str_t slit_6 = FX_MAKE_STR("l");
            FX_CALL(_fx_cons_LS(&slit_6, result_3, true, &result_10), _fx_catch_6);
            _fx_free_LS(&result_1);
            FX_COPY_PTR(result_10, &result_1);
            FX_BREAK(_fx_catch_6);

         _fx_catch_6: ;
            if (result_10) {
               _fx_free_LS(&result_10);
            }
            goto _fx_endmatch_0;
         }
      }
      if (tag_0 == 3) {
         fx_str_t v_0 = {0};
         fx_str_t v_1 = {0};
         fx_exn_t v_2 = {0};
         FX_CALL(_fx_F6stringS1i(t_2->u.KTypSInt, &v_0, 0), _fx_catch_7);
         fx_str_t slit_7 = FX_MAKE_STR("unsupported typ KTypSInt(");
         fx_str_t slit_8 = FX_MAKE_STR(")");
         {
            const fx_str_t strs_0[] = { slit_7, v_0, slit_8 };
            FX_CALL(fx_strjoin(0, 0, 0, strs_0, 3, &v_1), _fx_catch_7);
         }
         FX_CALL(_fx_M3AstFM11compile_errE2RM5loc_tS(loc_0, &v_1, &v_2, 0), _fx_catch_7);
         FX_THROW(&v_2, false, _fx_catch_7);

      _fx_catch_7: ;
         fx_free_exn(&v_2);
         FX_FREE_STR(&v_1);
         FX_FREE_STR(&v_0);
         goto _fx_endmatch_0;
      }
      if (tag_0 == 4) {
         if (t_2->u.KTypUInt == 8) {
            _fx_LS result_11 = 0;
            fx_str_t slit_9 = FX_MAKE_STR("b");
            FX_CALL(_fx_cons_LS(&slit_9, result_3, true, &result_11), _fx_catch_8);
            _fx_free_LS(&result_1);
            FX_COPY_PTR(result_11, &result_1);
            FX_BREAK(_fx_catch_8);

         _fx_catch_8: ;
            if (result_11) {
               _fx_free_LS(&result_11);
            }
            goto _fx_endmatch_0;
         }
      }
      if (tag_0 == 4) {
         if (t_2->u.KTypUInt == 16) {
            _fx_LS result_12 = 0;
            fx_str_t slit_10 = FX_MAKE_STR("w");
            FX_CALL(_fx_cons_LS(&slit_10, result_3, true, &result_12), _fx_catch_9);
            _fx_free_LS(&result_1);
            FX_COPY_PTR(result_12, &result_1);
            FX_BREAK(_fx_catch_9);

         _fx_catch_9: ;
            if (result_12) {
               _fx_free_LS(&result_12);
            }
            goto _fx_endmatch_0;
         }
      }
      if (tag_0 == 4) {
         if (t_2->u.KTypUInt == 32) {
            _fx_LS result_13 = 0;
            fx_str_t slit_11 = FX_MAKE_STR("u");
            FX_CALL(_fx_cons_LS(&slit_11, result_3, true, &result_13), _fx_catch_10);
            _fx_free_LS(&result_1);
            FX_COPY_PTR(result_13, &result_1);
            FX_BREAK(_fx_catch_10);

         _fx_catch_10: ;
            if (result_13) {
               _fx_free_LS(&result_13);
            }
            goto _fx_endmatch_0;
         }
      }
      if (tag_0 == 4) {
         if (t_2->u.KTypUInt == 64) {
            _fx_LS result_14 = 0;
            fx_str_t slit_12 = FX_MAKE_STR("q");
            FX_CALL(_fx_cons_LS(&slit_12, result_3, true, &result_14), _fx_catch_11);
            _fx_free_LS(&result_1);
            FX_COPY_PTR(result_14, &result_1);
            FX_BREAK(_fx_catch_11);

         _fx_catch_11: ;
            if (result_14) {
               _fx_free_LS(&result_14);
            }
            goto _fx_endmatch_0;
         }
      }
      if (tag_0 == 4) {
         fx_str_t v_3 = {0};
         fx_str_t v_4 = {0};
         fx_exn_t v_5 = {0};
         FX_CALL(_fx_F6stringS1i(t_2->u.KTypUInt, &v_3, 0), _fx_catch_12);
         fx_str_t slit_13 = FX_MAKE_STR("unsupported typ KTypUInt(");
         fx_str_t slit_14 = FX_MAKE_STR(")");
         {
            const fx_str_t strs_1[] = { slit_13, v_3, slit_14 };
            FX_CALL(fx_strjoin(0, 0, 0, strs_1, 3, &v_4), _fx_catch_12);
         }
         FX_CALL(_fx_M3AstFM11compile_errE2RM5loc_tS(loc_0, &v_4, &v_5, 0), _fx_catch_12);
         FX_THROW(&v_5, false, _fx_catch_12);

      _fx_catch_12: ;
         fx_free_exn(&v_5);
         FX_FREE_STR(&v_4);
         FX_FREE_STR(&v_3);
         goto _fx_endmatch_0;
      }
      if (tag_0 == 5) {
         if (t_2->u.KTypFloat == 16) {
            _fx_LS result_15 = 0;
            fx_str_t slit_15 = FX_MAKE_STR("h");
            FX_CALL(_fx_cons_LS(&slit_15, result_3, true, &result_15), _fx_catch_13);
            _fx_free_LS(&result_1);
            FX_COPY_PTR(result_15, &result_1);
            FX_BREAK(_fx_catch_13);

         _fx_catch_13: ;
            if (result_15) {
               _fx_free_LS(&result_15);
            }
            goto _fx_endmatch_0;
         }
      }
      if (tag_0 == 5) {
         if (t_2->u.KTypFloat == 32) {
            _fx_LS result_16 = 0;
            fx_str_t slit_16 = FX_MAKE_STR("f");
            FX_CALL(_fx_cons_LS(&slit_16, result_3, true, &result_16), _fx_catch_14);
            _fx_free_LS(&result_1);
            FX_COPY_PTR(result_16, &result_1);
            FX_BREAK(_fx_catch_14);

         _fx_catch_14: ;
            if (result_16) {
               _fx_free_LS(&result_16);
            }
            goto _fx_endmatch_0;
         }
      }
      if (tag_0 == 5) {
         if (t_2->u.KTypFloat == 64) {
            _fx_LS result_17 = 0;
            fx_str_t slit_17 = FX_MAKE_STR("d");
            FX_CALL(_fx_cons_LS(&slit_17, result_3, true, &result_17), _fx_catch_15);
            _fx_free_LS(&result_1);
            FX_COPY_PTR(result_17, &result_1);
            FX_BREAK(_fx_catch_15);

         _fx_catch_15: ;
            if (result_17) {
               _fx_free_LS(&result_17);
            }
            goto _fx_endmatch_0;
         }
      }
      if (tag_0 == 5) {
         fx_str_t v_6 = {0};
         fx_str_t v_7 = {0};
         fx_exn_t v_8 = {0};
         FX_CALL(_fx_F6stringS1i(t_2->u.KTypFloat, &v_6, 0), _fx_catch_16);
         fx_str_t slit_18 = FX_MAKE_STR("unsupported typ KTypFloat(");
         fx_str_t slit_19 = FX_MAKE_STR(")");
         {
            const fx_str_t strs_2[] = { slit_18, v_6, slit_19 };
            FX_CALL(fx_strjoin(0, 0, 0, strs_2, 3, &v_7), _fx_catch_16);
         }
         FX_CALL(_fx_M3AstFM11compile_errE2RM5loc_tS(loc_0, &v_7, &v_8, 0), _fx_catch_16);
         FX_THROW(&v_8, false, _fx_catch_16);

      _fx_catch_16: ;
         fx_free_exn(&v_8);
         FX_FREE_STR(&v_7);
         FX_FREE_STR(&v_6);
         goto _fx_endmatch_0;
      }
      if (tag_0 == 7) {
         _fx_LS result_18 = 0;
         fx_str_t slit_20 = FX_MAKE_STR("v");
         FX_CALL(_fx_cons_LS(&slit_20, result_3, true, &result_18), _fx_catch_17);
         _fx_free_LS(&result_1);
         FX_COPY_PTR(result_18, &result_1);
         FX_BREAK(_fx_catch_17);

      _fx_catch_17: ;
         if (result_18) {
            _fx_free_LS(&result_18);
         }
         goto _fx_endmatch_0;
      }
      if (tag_0 == 8) {
         _fx_LS result_19 = 0;
         fx_str_t slit_21 = FX_MAKE_STR("B");
         FX_CALL(_fx_cons_LS(&slit_21, result_3, true, &result_19), _fx_catch_18);
         _fx_free_LS(&result_1);
         FX_COPY_PTR(result_19, &result_1);
         FX_BREAK(_fx_catch_18);

      _fx_catch_18: ;
         if (result_19) {
            _fx_free_LS(&result_19);
         }
         goto _fx_endmatch_0;
      }
      if (tag_0 == 9) {
         _fx_LS result_20 = 0;
         fx_str_t slit_22 = FX_MAKE_STR("C");
         FX_CALL(_fx_cons_LS(&slit_22, result_3, true, &result_20), _fx_catch_19);
         _fx_free_LS(&result_1);
         FX_COPY_PTR(result_20, &result_1);
         FX_BREAK(_fx_catch_19);

      _fx_catch_19: ;
         if (result_20) {
            _fx_free_LS(&result_20);
         }
         goto _fx_endmatch_0;
      }
      if (tag_0 == 10) {
         _fx_LS result_21 = 0;
         fx_str_t slit_23 = FX_MAKE_STR("S");
         FX_CALL(_fx_cons_LS(&slit_23, result_3, true, &result_21), _fx_catch_20);
         _fx_free_LS(&result_1);
         FX_COPY_PTR(result_21, &result_1);
         FX_BREAK(_fx_catch_20);

      _fx_catch_20: ;
         if (result_21) {
            _fx_free_LS(&result_21);
         }
         goto _fx_endmatch_0;
      }
      if (tag_0 == 11) {
         _fx_LS result_22 = 0;
         fx_str_t slit_24 = FX_MAKE_STR("p");
         FX_CALL(_fx_cons_LS(&slit_24, result_3, true, &result_22), _fx_catch_21);
         _fx_free_LS(&result_1);
         FX_COPY_PTR(result_22, &result_1);
         FX_BREAK(_fx_catch_21);

      _fx_catch_21: ;
         if (result_22) {
            _fx_free_LS(&result_22);
         }
         goto _fx_endmatch_0;
      }
      if (tag_0 == 12) {
         _fx_LS v_9 = 0;
         fx_str_t slit_25 = FX_MAKE_STR("P");
         FX_CALL(_fx_cons_LS(&slit_25, result_3, true, &v_9), _fx_catch_22);
         _fx_N14K_form__ktyp_t* t_3 = &t_2->u.KTypRawPointer;
         _fx_free_N14K_form__ktyp_t(&t_1);
         FX_COPY_PTR(*t_3, &t_1);
         _fx_free_LS(&result_2);
         FX_COPY_PTR(v_9, &result_2);

      _fx_catch_22: ;
         if (v_9) {
            _fx_free_LS(&v_9);
         }
         goto _fx_endmatch_0;
      }
      if (tag_0 == 13) {
         _fx_LS v_10 = 0;
         _fx_LS result_23 = 0;
         fx_str_t v_11 = {0};
         _fx_LS result_24 = 0;
         _fx_LS __fold_result___0 = 0;
         _fx_LN14K_form__ktyp_t args_0 = 0;
         _fx_T2LN14K_form__ktyp_tN14K_form__ktyp_t* vcase_0 = &t_2->u.KTypFun;
         _fx_LN14K_form__ktyp_t args_1 = vcase_0->t0;
         fx_str_t slit_26 = FX_MAKE_STR("FP");
         FX_CALL(_fx_cons_LS(&slit_26, result_3, true, &v_10), _fx_catch_24);
         FX_CALL(
            _fx_M8K_mangleFM12mangle_ktyp_LS4N14K_form__ktyp_tLSR10Ast__loc_tNt10Hashmap__t2SR9Ast__id_t(vcase_0->t1, v_10,
               loc_0, mangle_map_0, &result_23, 0), _fx_catch_24);
         int_ v_12 = _fx_M8K_mangleFM6lengthi1LN14K_form__ktyp_t(args_1, 0);
         FX_CALL(_fx_F6stringS1i(v_12, &v_11, 0), _fx_catch_24);
         FX_CALL(_fx_cons_LS(&v_11, result_23, true, &result_24), _fx_catch_24);
         FX_COPY_PTR(result_24, &__fold_result___0);
         FX_COPY_PTR(args_1, &args_0);
         _fx_LN14K_form__ktyp_t lst_0 = args_0;
         for (; lst_0; lst_0 = lst_0->tl) {
            _fx_LS result_25 = 0;
            _fx_LS v_13 = 0;
            _fx_N14K_form__ktyp_t a_0 = lst_0->hd;
            FX_COPY_PTR(__fold_result___0, &result_25);
            FX_CALL(
               _fx_M8K_mangleFM12mangle_ktyp_LS4N14K_form__ktyp_tLSR10Ast__loc_tNt10Hashmap__t2SR9Ast__id_t(a_0, result_25,
                  loc_0, mangle_map_0, &v_13, 0), _fx_catch_23);
            _fx_free_LS(&__fold_result___0);
            FX_COPY_PTR(v_13, &__fold_result___0);

         _fx_catch_23: ;
            if (v_13) {
               _fx_free_LS(&v_13);
            }
            if (result_25) {
               _fx_free_LS(&result_25);
            }
            FX_CHECK_EXN(_fx_catch_24);
         }
         _fx_free_LS(&result_1);
         FX_COPY_PTR(__fold_result___0, &result_1);
         FX_BREAK(_fx_catch_24);

      _fx_catch_24: ;
         if (args_0) {
            _fx_free_LN14K_form__ktyp_t(&args_0);
         }
         if (__fold_result___0) {
            _fx_free_LS(&__fold_result___0);
         }
         if (result_24) {
            _fx_free_LS(&result_24);
         }
         FX_FREE_STR(&v_11);
         if (result_23) {
            _fx_free_LS(&result_23);
         }
         if (v_10) {
            _fx_free_LS(&v_10);
         }
         goto _fx_endmatch_0;
      }
      if (tag_0 == 14) {
         fx_str_t nstr_0 = {0};
         _fx_LN14K_form__ktyp_t elems_0 = t_2->u.KTypTuple;
         int_ nelems_0 = _fx_M8K_mangleFM6lengthi1LN14K_form__ktyp_t(elems_0, 0);
         FX_CALL(_fx_F6stringS1i(nelems_0, &nstr_0, 0), _fx_catch_29);
         if (elems_0 != 0) {
            _fx_LN14K_form__ktyp_t rest_0 = 0;
            _fx_LS v_14 = 0;
            _fx_LS v_15 = 0;
            _fx_LS __fold_result___1 = 0;
            _fx_LN14K_form__ktyp_t elems_1 = 0;
            _fx_N14K_form__ktyp_t t0_0 = elems_0->hd;
            bool __fold_result___2 = true;
            FX_COPY_PTR(elems_0->tl, &rest_0);
            _fx_LN14K_form__ktyp_t lst_1 = rest_0;
            for (; lst_1; lst_1 = lst_1->tl) {
               _fx_N14K_form__ktyp_t a_1 = lst_1->hd;
               bool v_16;
               FX_CALL(_fx_M8K_mangleFM15__eq_variants__B2N14K_form__ktyp_tN14K_form__ktyp_t(a_1, t0_0, &v_16, 0),
                  _fx_catch_25);
               if (!v_16) {
                  __fold_result___2 = false; FX_BREAK(_fx_catch_25);
               }

            _fx_catch_25: ;
               FX_CHECK_BREAK();
               FX_CHECK_EXN(_fx_catch_27);
            }
            if (__fold_result___2) {
               fx_str_t slit_27 = FX_MAKE_STR("Ta");
               FX_CALL(_fx_cons_LS(&slit_27, result_3, true, &v_14), _fx_catch_27);
               FX_CALL(_fx_cons_LS(&nstr_0, v_14, false, &v_14), _fx_catch_27);
               _fx_free_N14K_form__ktyp_t(&t_1);
               FX_COPY_PTR(t0_0, &t_1);
               _fx_free_LS(&result_2);
               FX_COPY_PTR(v_14, &result_2);
            }
            else {
               fx_str_t slit_28 = FX_MAKE_STR("T");
               FX_CALL(_fx_cons_LS(&slit_28, result_3, true, &v_15), _fx_catch_27);
               FX_CALL(_fx_cons_LS(&nstr_0, v_15, true, &__fold_result___1), _fx_catch_27);
               FX_COPY_PTR(elems_0, &elems_1);
               _fx_LN14K_form__ktyp_t lst_2 = elems_1;
               for (; lst_2; lst_2 = lst_2->tl) {
                  _fx_LS result_26 = 0;
                  _fx_LS v_17 = 0;
                  _fx_N14K_form__ktyp_t t_4 = lst_2->hd;
                  FX_COPY_PTR(__fold_result___1, &result_26);
                  FX_CALL(
                     _fx_M8K_mangleFM12mangle_ktyp_LS4N14K_form__ktyp_tLSR10Ast__loc_tNt10Hashmap__t2SR9Ast__id_t(t_4,
                        result_26, loc_0, mangle_map_0, &v_17, 0), _fx_catch_26);
                  _fx_free_LS(&__fold_result___1);
                  FX_COPY_PTR(v_17, &__fold_result___1);

               _fx_catch_26: ;
                  if (v_17) {
                     _fx_free_LS(&v_17);
                  }
                  if (result_26) {
                     _fx_free_LS(&result_26);
                  }
                  FX_CHECK_EXN(_fx_catch_27);
               }
               _fx_free_LS(&result_1);
               FX_COPY_PTR(__fold_result___1, &result_1);
               FX_BREAK(_fx_catch_27);
            }

         _fx_catch_27: ;
            if (elems_1) {
               _fx_free_LN14K_form__ktyp_t(&elems_1);
            }
            if (__fold_result___1) {
               _fx_free_LS(&__fold_result___1);
            }
            if (v_15) {
               _fx_free_LS(&v_15);
            }
            if (v_14) {
               _fx_free_LS(&v_14);
            }
            if (rest_0) {
               _fx_free_LN14K_form__ktyp_t(&rest_0);
            }
         }
         else {
            fx_exn_t v_18 = {0};
            fx_str_t slit_29 = FX_MAKE_STR("the tuple has 0 elements");
            FX_CALL(_fx_M3AstFM11compile_errE2RM5loc_tS(loc_0, &slit_29, &v_18, 0), _fx_catch_28);
            FX_THROW(&v_18, false, _fx_catch_28);

         _fx_catch_28: ;
            fx_free_exn(&v_18);
         }
         FX_CHECK_EXN(_fx_catch_29);

      _fx_catch_29: ;
         FX_FREE_STR(&nstr_0);
         goto _fx_endmatch_0;
      }
      if (tag_0 == 15) {
         _fx_LS result_27 = 0;
         FX_CALL(
            _fx_M8K_mangleFM15mangle_typname_LS4R9Ast__id_tLSR10Ast__loc_tNt10Hashmap__t2SR9Ast__id_t(&t_2->u.KTypRecord.t0,
               result_3, loc_0, mangle_map_0, &result_27, 0), _fx_catch_30);
         _fx_free_LS(&result_1);
         FX_COPY_PTR(result_27, &result_1);
         FX_BREAK(_fx_catch_30);

      _fx_catch_30: ;
         if (result_27) {
            _fx_free_LS(&result_27);
         }
         goto _fx_endmatch_0;
      }
      if (tag_0 == 16) {
         _fx_LS result_28 = 0;
         FX_CALL(
            _fx_M8K_mangleFM15mangle_typname_LS4R9Ast__id_tLSR10Ast__loc_tNt10Hashmap__t2SR9Ast__id_t(&t_2->u.KTypName,
               result_3, loc_0, mangle_map_0, &result_28, 0), _fx_catch_31);
         _fx_free_LS(&result_1);
         FX_COPY_PTR(result_28, &result_1);
         FX_BREAK(_fx_catch_31);

      _fx_catch_31: ;
         if (result_28) {
            _fx_free_LS(&result_28);
         }
         goto _fx_endmatch_0;
      }
      if (tag_0 == 17) {
         fx_str_t v_19 = {0};
         _fx_LS v_20 = 0;
         _fx_LS result_29 = 0;
         _fx_T2iN14K_form__ktyp_t* vcase_1 = &t_2->u.KTypArray;
         FX_CALL(_fx_F6stringS1i(vcase_1->t0, &v_19, 0), _fx_catch_32);
         fx_str_t slit_30 = FX_MAKE_STR("A");
         FX_CALL(_fx_cons_LS(&slit_30, result_3, true, &v_20), _fx_catch_32);
         FX_CALL(_fx_cons_LS(&v_19, v_20, true, &result_29), _fx_catch_32);
         _fx_N14K_form__ktyp_t* t_5 = &vcase_1->t1;
         _fx_free_N14K_form__ktyp_t(&t_1);
         FX_COPY_PTR(*t_5, &t_1);
         _fx_free_LS(&result_2);
         FX_COPY_PTR(result_29, &result_2);

      _fx_catch_32: ;
         if (result_29) {
            _fx_free_LS(&result_29);
         }
         if (v_20) {
            _fx_free_LS(&v_20);
         }
         FX_FREE_STR(&v_19);
         goto _fx_endmatch_0;
      }
      if (tag_0 == 19) {
         _fx_LS v_21 = 0;
         fx_str_t slit_31 = FX_MAKE_STR("L");
         FX_CALL(_fx_cons_LS(&slit_31, result_3, true, &v_21), _fx_catch_33);
         _fx_N14K_form__ktyp_t* t_6 = &t_2->u.KTypList;
         _fx_free_N14K_form__ktyp_t(&t_1);
         FX_COPY_PTR(*t_6, &t_1);
         _fx_free_LS(&result_2);
         FX_COPY_PTR(v_21, &result_2);

      _fx_catch_33: ;
         if (v_21) {
            _fx_free_LS(&v_21);
         }
         goto _fx_endmatch_0;
      }
      if (tag_0 == 18) {
         _fx_LS v_22 = 0;
         fx_str_t slit_32 = FX_MAKE_STR("V");
         FX_CALL(_fx_cons_LS(&slit_32, result_3, true, &v_22), _fx_catch_34);
         _fx_N14K_form__ktyp_t* t_7 = &t_2->u.KTypVector;
         _fx_free_N14K_form__ktyp_t(&t_1);
         FX_COPY_PTR(*t_7, &t_1);
         _fx_free_LS(&result_2);
         FX_COPY_PTR(v_22, &result_2);

      _fx_catch_34: ;
         if (v_22) {
            _fx_free_LS(&v_22);
         }
         goto _fx_endmatch_0;
      }
      if (tag_0 == 20) {
         _fx_LS v_23 = 0;
         fx_str_t slit_33 = FX_MAKE_STR("r");
         FX_CALL(_fx_cons_LS(&slit_33, result_3, true, &v_23), _fx_catch_35);
         _fx_N14K_form__ktyp_t* t_8 = &t_2->u.KTypRef;
         _fx_free_N14K_form__ktyp_t(&t_1);
         FX_COPY_PTR(*t_8, &t_1);
         _fx_free_LS(&result_2);
         FX_COPY_PTR(v_23, &result_2);

      _fx_catch_35: ;
         if (v_23) {
            _fx_free_LS(&v_23);
         }
         goto _fx_endmatch_0;
      }
      if (tag_0 == 21) {
         _fx_LS result_30 = 0;
         fx_str_t slit_34 = FX_MAKE_STR("E");
         FX_CALL(_fx_cons_LS(&slit_34, result_3, true, &result_30), _fx_catch_36);
         _fx_free_LS(&result_1);
         FX_COPY_PTR(result_30, &result_1);
         FX_BREAK(_fx_catch_36);

      _fx_catch_36: ;
         if (result_30) {
            _fx_free_LS(&result_30);
         }
         goto _fx_endmatch_0;
      }
      if (tag_0 == 22) {
         fx_exn_t v_24 = {0};
         fx_str_t slit_35 = FX_MAKE_STR("KTypErr cannot be mangled");
         FX_CALL(_fx_M3AstFM11compile_errE2RM5loc_tS(loc_0, &slit_35, &v_24, 0), _fx_catch_37);
         FX_THROW(&v_24, false, _fx_catch_37);

      _fx_catch_37: ;
         fx_free_exn(&v_24);
         goto _fx_endmatch_0;
      }
      if (tag_0 == 23) {
         fx_exn_t v_25 = {0};
         fx_str_t slit_36 = FX_MAKE_STR("KTypModule cannot be mangled");
         FX_CALL(_fx_M3AstFM11compile_errE2RM5loc_tS(loc_0, &slit_36, &v_25, 0), _fx_catch_38);
         FX_THROW(&v_25, false, _fx_catch_38);

      _fx_catch_38: ;
         fx_free_exn(&v_25);
         goto _fx_endmatch_0;
      }
      FX_FAST_THROW(FX_EXN_NoMatchError, _fx_catch_39);

   _fx_endmatch_0: ;
      FX_CHECK_EXN(_fx_catch_39);

   _fx_catch_39: ;
      if (result_3) {
         _fx_free_LS(&result_3);
      }
      if (t_2) {
         _fx_free_N14K_form__ktyp_t(&t_2);
      }
      FX_CHECK_BREAK();
      FX_CHECK_EXN(_fx_cleanup);
   }
   FX_COPY_PTR(result_1, fx_result);

_fx_cleanup: ;
   if (result_1) {
      _fx_free_LS(&result_1);
   }
   if (t_1) {
      _fx_free_N14K_form__ktyp_t(&t_1);
   }
   if (result_2) {
      _fx_free_LS(&result_2);
   }
   return fx_status;
}

FX_EXTERN_C int _fx_M8K_mangleFM10mangle_allLR17K_form__kmodule_t2LR17K_form__kmodule_tB(
   struct _fx_LR17K_form__kmodule_t_data_t* kmods_0,
   bool final_mode_0,
   struct _fx_LR17K_form__kmodule_t_data_t** fx_result,
   void* fx_fv)
{
   _fx_Nt10Hashmap__t2SR9Ast__id_t mangle_map_0 = 0;
   _fx_rLN14K_form__kexp_t curr_top_code_ref_0 = 0;
   _fx_ri curr_km_idx_ref_0 = 0;
   _fx_FPN14K_form__ktyp_t3N14K_form__ktyp_tR10Ast__loc_tR17K_form__k_callb_t walk_ktyp_n_mangle_0 = {0};
   _fx_FPN14K_form__ktyp_t7R9Ast__id_tR10Ast__loc_tR17K_form__k_callb_trirLN14K_form__kexp_tBNt10Hashmap__t2SR9Ast__id_t
      mangle_id_typ_0 = {0};
   _fx_FPN14K_form__kexp_t2N14K_form__kexp_tR17K_form__k_callb_t walk_kexp_n_mangle_0 = {0};
   _fx_Nt6option1FPN14K_form__ktyp_t3N14K_form__ktyp_tR10Ast__loc_tR17K_form__k_callb_t v_0 = 0;
   _fx_Nt6option1FPN14K_form__kexp_t2N14K_form__kexp_tR17K_form__k_callb_t v_1 = 0;
   _fx_R17K_form__k_callb_t walk_n_mangle_callb_0 = {0};
   int fx_status = 0;
   fx_str_t slit_0 = FX_MAKE_STR("");
   FX_CALL(_fx_M8K_mangleFM5emptyNt10Hashmap__t2SR9Ast__id_t3iSR9Ast__id_t(1024, &slit_0, &_fx_g9Ast__noid, &mangle_map_0, 0),
      _fx_cleanup);
   FX_CALL(_fx_make_rLN14K_form__kexp_t(0, &curr_top_code_ref_0), _fx_cleanup);
   _fx_LN14K_form__kexp_t* curr_top_code_0 = &curr_top_code_ref_0->data;
   FX_CALL(_fx_make_ri(-1, &curr_km_idx_ref_0), _fx_cleanup);
   _fx_M8K_mangleFM7make_fpFPN14K_form__ktyp_t3N14K_form__ktyp_tR10Ast__loc_tR17K_form__k_callb_t4rirLN14K_form__kexp_tBNt10Hashmap__t2SR9Ast__id_t(
      curr_km_idx_ref_0, curr_top_code_ref_0, final_mode_0, mangle_map_0, &walk_ktyp_n_mangle_0);
   _fx_M8K_mangleFM7make_fpFPN14K_form__ktyp_t7R9Ast__id_tR10Ast__loc_tR17K_form__k_callb_trirLN14K_form__kexp_tBNt10Hashmap__t2SR9Ast__id_t4rirLN14K_form__kexp_tBNt10Hashmap__t2SR9Ast__id_t(
      curr_km_idx_ref_0, curr_top_code_ref_0, final_mode_0, mangle_map_0, &mangle_id_typ_0);
   _fx_M8K_mangleFM7make_fpFPN14K_form__kexp_t2N14K_form__kexp_tR17K_form__k_callb_t4rirLN14K_form__kexp_tBNt10Hashmap__t2SR9Ast__id_t(
      curr_km_idx_ref_0, curr_top_code_ref_0, final_mode_0, mangle_map_0, &walk_kexp_n_mangle_0);
   FX_CALL(
      _fx_M8K_mangleFM4SomeNt6option1FPN14K_form__ktyp_t3N14K_form__ktyp_tR10Ast__loc_tR17K_form__k_callb_t1FPN14K_form__ktyp_t3N14K_form__ktyp_tR10Ast__loc_tR17K_form__k_callb_t(
         &walk_ktyp_n_mangle_0, &v_0), _fx_cleanup);
   FX_CALL(
      _fx_M8K_mangleFM4SomeNt6option1FPN14K_form__kexp_t2N14K_form__kexp_tR17K_form__k_callb_t1FPN14K_form__kexp_t2N14K_form__kexp_tR17K_form__k_callb_t(
         &walk_kexp_n_mangle_0, &v_1), _fx_cleanup);
   _fx_make_R17K_form__k_callb_t(v_0, v_1, _fx_g16K_mangle__None1_, &walk_n_mangle_callb_0);
   _fx_LR17K_form__kmodule_t lstend_0 = 0;
   _fx_LR17K_form__kmodule_t lst_0 = kmods_0;
   for (; lst_0; lst_0 = lst_0->tl) {
      _fx_LN14K_form__kexp_t km_top_0 = 0;
      _fx_LN14K_form__kexp_t v_2 = 0;
      _fx_R17K_form__kmodule_t rec_0 = {0};
      _fx_R17K_form__kmodule_t* km_0 = &lst_0->hd;
      FX_COPY_PTR(km_0->km_top, &km_top_0);
      int_ km_idx_0 = km_0->km_idx;
      FX_CALL(_fx_M8K_mangleFM5clearv1Nt10Hashmap__t2SR9Ast__id_t(mangle_map_0, 0), _fx_catch_2);
      _fx_free_LN14K_form__kexp_t(curr_top_code_0);
      *curr_top_code_0 = 0;
      curr_km_idx_ref_0->data = km_idx_0;
      _fx_LN14K_form__kexp_t lst_1 = km_top_0;
      for (; lst_1; lst_1 = lst_1->tl) {
         _fx_N14K_form__kexp_t e_0 = 0;
         _fx_LN14K_form__kexp_t v_3 = 0;
         _fx_N14K_form__kexp_t e_1 = lst_1->hd;
         FX_CALL(walk_kexp_n_mangle_0.fp(e_1, &walk_n_mangle_callb_0, &e_0, walk_kexp_n_mangle_0.fcv), _fx_catch_1);
         if (final_mode_0) {
            if (FX_REC_VARIANT_TAG(e_0) == 31) {
               _fx_R17K_form__kdefval_t kv_0 = {0};
               _fx_R16Ast__val_flags_t kv_flags_0 = {0};
               fx_str_t kv_cname_0 = {0};
               _fx_LN12Ast__scope_t v_4 = 0;
               _fx_R16Ast__val_flags_t v_5 = {0};
               _fx_R17K_form__kdefval_t v_6 = {0};
               _fx_N15K_form__kinfo_t v_7 = {0};
               _fx_N14K_form__ktyp_t v_8 = 0;
               _fx_T3R9Ast__id_tN14K_form__kexp_tR10Ast__loc_t* vcase_0 = &e_0->u.KDefVal;
               _fx_R10Ast__loc_t* loc_0 = &vcase_0->t2;
               _fx_R9Ast__id_t* n_0 = &vcase_0->t0;
               FX_CALL(_fx_M6K_formFM8get_kvalRM9kdefval_t2R9Ast__id_tR10Ast__loc_t(n_0, loc_0, &kv_0, 0), _fx_catch_0);
               _fx_copy_R16Ast__val_flags_t(&kv_0.kv_flags, &kv_flags_0);
               fx_copy_str(&kv_0.kv_cname, &kv_cname_0);
               if (FX_STR_LENGTH(kv_cname_0) == 0) {
                  bool t_0;
                  if (kv_flags_0.val_flag_temp) {
                     t_0 = true;
                  }
                  else {
                     t_0 = kv_flags_0.val_flag_tempref;
                  }
                  if (!t_0) {
                     _fx_N12Ast__scope_t v_9;
                     _fx_M3AstFM8ScModuleN12Ast__scope_t1i(km_idx_0, &v_9);
                     FX_CALL(_fx_cons_LN12Ast__scope_t(&v_9, 0, true, &v_4), _fx_catch_0);
                     _fx_make_R16Ast__val_flags_t(kv_flags_0.val_flag_arg, kv_flags_0.val_flag_mutable,
                        kv_flags_0.val_flag_temp, kv_flags_0.val_flag_tempref, kv_flags_0.val_flag_private,
                        kv_flags_0.val_flag_subarray, kv_flags_0.val_flag_instance, &kv_flags_0.val_flag_method,
                        kv_flags_0.val_flag_ctor, v_4, &v_5);
                     _fx_make_R17K_form__kdefval_t(&kv_0.kv_name, &kv_0.kv_cname, kv_0.kv_typ, &v_5, &kv_0.kv_loc, &v_6);
                     _fx_M6K_formFM4KValN15K_form__kinfo_t1RM9kdefval_t(&v_6, &v_7);
                     FX_CALL(_fx_M6K_formFM13set_idk_entryv2R9Ast__id_tN15K_form__kinfo_t(n_0, &v_7, 0), _fx_catch_0);
                     FX_CALL(
                        mangle_id_typ_0.fp(n_0, loc_0, &walk_n_mangle_callb_0, curr_km_idx_ref_0, curr_top_code_ref_0,
                           final_mode_0, mangle_map_0, &v_8, mangle_id_typ_0.fcv), _fx_catch_0);
                     FX_CALL(_fx_M8K_mangleFM6ignorev1N14K_form__ktyp_t(v_8, 0), _fx_catch_0);
                  }
               }

            _fx_catch_0: ;
               if (v_8) {
                  _fx_free_N14K_form__ktyp_t(&v_8);
               }
               _fx_free_N15K_form__kinfo_t(&v_7);
               _fx_free_R17K_form__kdefval_t(&v_6);
               _fx_free_R16Ast__val_flags_t(&v_5);
               FX_FREE_LIST_SIMPLE(&v_4);
               FX_FREE_STR(&kv_cname_0);
               _fx_free_R16Ast__val_flags_t(&kv_flags_0);
               _fx_free_R17K_form__kdefval_t(&kv_0);
            }
            FX_CHECK_EXN(_fx_catch_1);
         }
         FX_CALL(_fx_cons_LN14K_form__kexp_t(e_0, *curr_top_code_0, true, &v_3), _fx_catch_1);
         _fx_free_LN14K_form__kexp_t(curr_top_code_0);
         FX_COPY_PTR(v_3, curr_top_code_0);

      _fx_catch_1: ;
         if (v_3) {
            _fx_free_LN14K_form__kexp_t(&v_3);
         }
         if (e_0) {
            _fx_free_N14K_form__kexp_t(&e_0);
         }
         FX_CHECK_EXN(_fx_catch_2);
      }
      FX_CALL(_fx_M8K_mangleFM3revLN14K_form__kexp_t1LN14K_form__kexp_t(*curr_top_code_0, &v_2, 0), _fx_catch_2);
      _fx_make_R17K_form__kmodule_t(&km_0->km_name, km_0->km_idx, km_0->km_toposort_idx, &km_0->km_cname, v_2, km_0->km_deps,
         km_0->km_skip, km_0->km_main, &km_0->km_pragmas, &rec_0);
      _fx_LR17K_form__kmodule_t node_0 = 0;
      FX_CALL(_fx_cons_LR17K_form__kmodule_t(&rec_0, 0, false, &node_0), _fx_catch_2);
      FX_LIST_APPEND(*fx_result, lstend_0, node_0);

   _fx_catch_2: ;
      _fx_free_R17K_form__kmodule_t(&rec_0);
      if (v_2) {
         _fx_free_LN14K_form__kexp_t(&v_2);
      }
      if (km_top_0) {
         _fx_free_LN14K_form__kexp_t(&km_top_0);
      }
      FX_CHECK_EXN(_fx_cleanup);
   }

_fx_cleanup: ;
   if (mangle_map_0) {
      _fx_free_Nt10Hashmap__t2SR9Ast__id_t(&mangle_map_0);
   }
   if (curr_top_code_ref_0) {
      _fx_free_rLN14K_form__kexp_t(&curr_top_code_ref_0);
   }
   FX_FREE_REF_SIMPLE(&curr_km_idx_ref_0);
   FX_FREE_FP(&walk_ktyp_n_mangle_0);
   FX_FREE_FP(&mangle_id_typ_0);
   FX_FREE_FP(&walk_kexp_n_mangle_0);
   if (v_0) {
      _fx_free_Nt6option1FPN14K_form__ktyp_t3N14K_form__ktyp_tR10Ast__loc_tR17K_form__k_callb_t(&v_0);
   }
   if (v_1) {
      _fx_free_Nt6option1FPN14K_form__kexp_t2N14K_form__kexp_tR17K_form__k_callb_t(&v_1);
   }
   _fx_free_R17K_form__k_callb_t(&walk_n_mangle_callb_0);
   return fx_status;
}

static int
   _fx_M8K_mangleFM14create_gen_typN14K_form__ktyp_t6N14K_form__ktyp_tSR10Ast__loc_trirLN14K_form__kexp_tNt10Hashmap__t2SR9Ast__id_t(
   struct _fx_N14K_form__ktyp_t_data_t* t_0,
   fx_str_t* name_prefix_0,
   struct _fx_R10Ast__loc_t* loc_0,
   struct _fx_ri_data_t* curr_km_idx_ref_0,
   struct _fx_rLN14K_form__kexp_t_data_t* curr_top_code_ref_0,
   struct _fx_Nt10Hashmap__t2SR9Ast__id_t_data_t* mangle_map_0,
   struct _fx_N14K_form__ktyp_t_data_t** fx_result,
   void* fx_fv)
{
   fx_str_t cname_0 = {0};
   int fx_status = 0;
   _fx_LN14K_form__kexp_t* curr_top_code_0 = &curr_top_code_ref_0->data;
   FX_CALL(
      _fx_M8K_mangleFM11mangle_ktypS3N14K_form__ktyp_tNt10Hashmap__t2SR9Ast__id_tR10Ast__loc_t(t_0, mangle_map_0, loc_0,
         &cname_0, 0), _fx_cleanup);
   _fx_Ta2i v_0;
   FX_CALL(_fx_M8K_mangleFM9find_idx_Ta2i2Nt10Hashmap__t2SR9Ast__id_tS(mangle_map_0, &cname_0, &v_0, 0), _fx_cleanup);
   int_ j_0 = v_0.t1;
   _fx_Nt6option1R9Ast__id_t v_1;
   if (j_0 >= 0) {
      FX_CHKIDX(FX_CHKIDX1(mangle_map_0->u.t.t5, 0, j_0), _fx_cleanup);
      _fx_R9Ast__id_t v_2 = FX_PTR_1D(_fx_Rt20Hashmap__hashentry_t2SR9Ast__id_t, mangle_map_0->u.t.t5, j_0)->data;
      _fx_M8K_mangleFM4SomeNt6option1R9Ast__id_t1R9Ast__id_t(&v_2, &v_1);
   }
   else {
      v_1 = _fx_g16K_mangle__None3_;
   }
   if (v_1.tag == 2) {
      FX_CALL(_fx_M6K_formFM8KTypNameN14K_form__ktyp_t1R9Ast__id_t(&v_1.u.Some, fx_result), _fx_catch_0);  _fx_catch_0: ;
   }
   else {
      fx_str_t v_3 = {0};
      _fx_R17K_form__kdeftyp_t v_4 = {0};
      _fx_rR17K_form__kdeftyp_t kt_0 = 0;
      _fx_N15K_form__kinfo_t v_5 = {0};
      _fx_N14K_form__kexp_t v_6 = 0;
      _fx_LN14K_form__kexp_t v_7 = 0;
      _fx_R9Ast__id_t i_0;
      FX_CALL(_fx_M6K_formFM7gen_idkR9Ast__id_t2iS(curr_km_idx_ref_0->data, name_prefix_0, &i_0, 0), _fx_catch_1);
      bool v_8;
      fx_str_t slit_0 = FX_MAKE_STR("_fx_");
      v_8 = _fx_M6StringFM10startswithB2SS(&cname_0, &slit_0, 0);
      if (v_8) {
         fx_copy_str(&cname_0, &v_3);
      }
      else {
         fx_str_t slit_1 = FX_MAKE_STR("_fx_");
         {
            const fx_str_t strs_0[] = { slit_1, cname_0 };
            FX_CALL(fx_strjoin(0, 0, 0, strs_0, 2, &v_3), _fx_catch_1);
         }
      }
      _fx_make_R17K_form__kdeftyp_t(&i_0, &v_3, &_fx_g9Ast__noid, &_fx_g16K_mangle__None2_, 0, t_0, 0, loc_0, &v_4);
      FX_CALL(_fx_make_rR17K_form__kdeftyp_t(&v_4, &kt_0), _fx_catch_1);
      int_ idx_0;
      FX_CALL(_fx_M8K_mangleFM18find_idx_or_inserti2Nt10Hashmap__t2SR9Ast__id_tS(mangle_map_0, &cname_0, &idx_0, 0),
         _fx_catch_1);
      FX_CHKIDX(FX_CHKIDX1(mangle_map_0->u.t.t5, 0, idx_0), _fx_catch_1);
      FX_PTR_1D(_fx_Rt20Hashmap__hashentry_t2SR9Ast__id_t, mangle_map_0->u.t.t5, idx_0)->data = i_0;
      _fx_M6K_formFM4KTypN15K_form__kinfo_t1rRM9kdeftyp_t(kt_0, &v_5);
      FX_CALL(_fx_M6K_formFM13set_idk_entryv2R9Ast__id_tN15K_form__kinfo_t(&i_0, &v_5, 0), _fx_catch_1);
      FX_CALL(_fx_M6K_formFM7KDefTypN14K_form__kexp_t1rRM9kdeftyp_t(kt_0, &v_6), _fx_catch_1);
      FX_CALL(_fx_cons_LN14K_form__kexp_t(v_6, *curr_top_code_0, true, &v_7), _fx_catch_1);
      _fx_free_LN14K_form__kexp_t(curr_top_code_0);
      FX_COPY_PTR(v_7, curr_top_code_0);
      FX_CALL(_fx_M6K_formFM8KTypNameN14K_form__ktyp_t1R9Ast__id_t(&i_0, fx_result), _fx_catch_1);

   _fx_catch_1: ;
      if (v_7) {
         _fx_free_LN14K_form__kexp_t(&v_7);
      }
      if (v_6) {
         _fx_free_N14K_form__kexp_t(&v_6);
      }
      _fx_free_N15K_form__kinfo_t(&v_5);
      if (kt_0) {
         _fx_free_rR17K_form__kdeftyp_t(&kt_0);
      }
      _fx_free_R17K_form__kdeftyp_t(&v_4);
      FX_FREE_STR(&v_3);
   }

_fx_cleanup: ;
   FX_FREE_STR(&cname_0);
   return fx_status;
}

static int _fx_M8K_mangleFM18walk_ktyp_n_mangleN14K_form__ktyp_t3N14K_form__ktyp_tR10Ast__loc_tR17K_form__k_callb_t(
   struct _fx_N14K_form__ktyp_t_data_t* t_0,
   struct _fx_R10Ast__loc_t* loc_0,
   struct _fx_R17K_form__k_callb_t* callb_0,
   struct _fx_N14K_form__ktyp_t_data_t** fx_result,
   void* fx_fv)
{
   _fx_N14K_form__ktyp_t t_1 = 0;
   int fx_status = 0;
   _fx_M8K_mangleFM18walk_ktyp_n_mangleN14K_form__ktyp_t3N14K_form__ktyp_tR10Ast__loc_tR17K_form__k_callb_t_cldata_t* cv_0 =
      (_fx_M8K_mangleFM18walk_ktyp_n_mangleN14K_form__ktyp_t3N14K_form__ktyp_tR10Ast__loc_tR17K_form__k_callb_t_cldata_t*)fx_fv;
   _fx_ri curr_km_idx_ref_0 = cv_0->t0;
   _fx_rLN14K_form__kexp_t curr_top_code_ref_0 = cv_0->t1;
   bool* final_mode_0 = &cv_0->t2;
   _fx_Nt10Hashmap__t2SR9Ast__id_t mangle_map_0 = cv_0->t3;
   FX_CALL(_fx_M6K_formFM9walk_ktypN14K_form__ktyp_t3N14K_form__ktyp_tR10Ast__loc_tRM9k_callb_t(t_0, loc_0, callb_0, &t_1, 0),
      _fx_cleanup);
   int tag_0 = FX_REC_VARIANT_TAG(t_1);
   bool res_0;
   if (tag_0 == 1) {
      res_0 = true;
   }
   else if (tag_0 == 6) {
      res_0 = true;
   }
   else if (tag_0 == 2) {
      res_0 = true;
   }
   else if (tag_0 == 3) {
      res_0 = true;
   }
   else if (tag_0 == 4) {
      res_0 = true;
   }
   else if (tag_0 == 5) {
      res_0 = true;
   }
   else if (tag_0 == 7) {
      res_0 = true;
   }
   else if (tag_0 == 8) {
      res_0 = true;
   }
   else if (tag_0 == 9) {
      res_0 = true;
   }
   else if (tag_0 == 10) {
      res_0 = true;
   }
   else if (tag_0 == 11) {
      res_0 = true;
   }
   else if (tag_0 == 12) {
      res_0 = true;
   }
   else {
      res_0 = false;
   }
   FX_CHECK_EXN(_fx_cleanup);
   if (res_0) {
      FX_COPY_PTR(t_1, fx_result); goto _fx_endmatch_0;
   }
   bool res_1;
   if (tag_0 == 21) {
      res_1 = true;
   }
   else if (tag_0 == 22) {
      res_1 = true;
   }
   else if (tag_0 == 23) {
      res_1 = true;
   }
   else {
      res_1 = false;
   }
   FX_CHECK_EXN(_fx_cleanup);
   if (res_1) {
      FX_COPY_PTR(t_1, fx_result); goto _fx_endmatch_0;
   }
   if (tag_0 == 16) {
      fx_str_t res_2 = {0};
      FX_CALL(
         _fx_M8K_mangleFM11mangle_ktypS3N14K_form__ktyp_tNt10Hashmap__t2SR9Ast__id_tR10Ast__loc_t(t_1, mangle_map_0, loc_0,
            &res_2, 0), _fx_catch_0);
      FX_COPY_PTR(t_1, fx_result);

   _fx_catch_0: ;
      FX_FREE_STR(&res_2);
      goto _fx_endmatch_0;
   }
   if (tag_0 == 15) {
      fx_str_t res_3 = {0};
      FX_CALL(
         _fx_M8K_mangleFM11mangle_ktypS3N14K_form__ktyp_tNt10Hashmap__t2SR9Ast__id_tR10Ast__loc_t(t_1, mangle_map_0, loc_0,
            &res_3, 0), _fx_catch_1);
      FX_CALL(_fx_M6K_formFM8KTypNameN14K_form__ktyp_t1R9Ast__id_t(&t_1->u.KTypRecord.t0, fx_result), _fx_catch_1);

   _fx_catch_1: ;
      FX_FREE_STR(&res_3);
      goto _fx_endmatch_0;
   }
   if (tag_0 == 13) {
      if (*final_mode_0) {
         fx_str_t slit_0 = FX_MAKE_STR("fun");
         FX_CALL(
            _fx_M8K_mangleFM14create_gen_typN14K_form__ktyp_t6N14K_form__ktyp_tSR10Ast__loc_trirLN14K_form__kexp_tNt10Hashmap__t2SR9Ast__id_t(
               t_1, &slit_0, loc_0, curr_km_idx_ref_0, curr_top_code_ref_0, mangle_map_0, fx_result, 0), _fx_catch_2);
      }
      else {
         FX_COPY_PTR(t_1, fx_result);
      }

   _fx_catch_2: ;
      goto _fx_endmatch_0;
   }
   if (tag_0 == 14) {
      if (*final_mode_0) {
         fx_str_t slit_1 = FX_MAKE_STR("tup");
         FX_CALL(
            _fx_M8K_mangleFM14create_gen_typN14K_form__ktyp_t6N14K_form__ktyp_tSR10Ast__loc_trirLN14K_form__kexp_tNt10Hashmap__t2SR9Ast__id_t(
               t_1, &slit_1, loc_0, curr_km_idx_ref_0, curr_top_code_ref_0, mangle_map_0, fx_result, 0), _fx_catch_3);
      }
      else {
         FX_COPY_PTR(t_1, fx_result);
      }

   _fx_catch_3: ;
      goto _fx_endmatch_0;
   }
   if (tag_0 == 17) {
      FX_COPY_PTR(t_1, fx_result); goto _fx_endmatch_0;
   }
   if (tag_0 == 18) {
      FX_COPY_PTR(t_1, fx_result); goto _fx_endmatch_0;
   }
   if (tag_0 == 19) {
      if (*final_mode_0) {
         fx_str_t slit_2 = FX_MAKE_STR("lst");
         FX_CALL(
            _fx_M8K_mangleFM14create_gen_typN14K_form__ktyp_t6N14K_form__ktyp_tSR10Ast__loc_trirLN14K_form__kexp_tNt10Hashmap__t2SR9Ast__id_t(
               t_1, &slit_2, loc_0, curr_km_idx_ref_0, curr_top_code_ref_0, mangle_map_0, fx_result, 0), _fx_catch_4);
      }
      else {
         FX_COPY_PTR(t_1, fx_result);
      }

   _fx_catch_4: ;
      goto _fx_endmatch_0;
   }
   if (tag_0 == 20) {
      if (*final_mode_0) {
         fx_str_t slit_3 = FX_MAKE_STR("ref");
         FX_CALL(
            _fx_M8K_mangleFM14create_gen_typN14K_form__ktyp_t6N14K_form__ktyp_tSR10Ast__loc_trirLN14K_form__kexp_tNt10Hashmap__t2SR9Ast__id_t(
               t_1, &slit_3, loc_0, curr_km_idx_ref_0, curr_top_code_ref_0, mangle_map_0, fx_result, 0), _fx_catch_5);
      }
      else {
         FX_COPY_PTR(t_1, fx_result);
      }

   _fx_catch_5: ;
      goto _fx_endmatch_0;
   }
   FX_FAST_THROW(FX_EXN_NoMatchError, _fx_cleanup);

_fx_endmatch_0: ;

_fx_cleanup: ;
   if (t_1) {
      _fx_free_N14K_form__ktyp_t(&t_1);
   }
   return fx_status;
}

FX_EXTERN_C int
   _fx_M8K_mangleFM7make_fpFPN14K_form__ktyp_t3N14K_form__ktyp_tR10Ast__loc_tR17K_form__k_callb_t4rirLN14K_form__kexp_tBNt10Hashmap__t2SR9Ast__id_t(
   struct _fx_ri_data_t* arg0,
   struct _fx_rLN14K_form__kexp_t_data_t* arg1,
   bool arg2,
   struct _fx_Nt10Hashmap__t2SR9Ast__id_t_data_t* arg3,
   struct _fx_FPN14K_form__ktyp_t3N14K_form__ktyp_tR10Ast__loc_tR17K_form__k_callb_t* fx_result)
{
   FX_MAKE_FP_IMPL_START(
      _fx_M8K_mangleFM18walk_ktyp_n_mangleN14K_form__ktyp_t3N14K_form__ktyp_tR10Ast__loc_tR17K_form__k_callb_t_cldata_t,
      _fx_free_M8K_mangleFM18walk_ktyp_n_mangleN14K_form__ktyp_t3N14K_form__ktyp_tR10Ast__loc_tR17K_form__k_callb_t,
      _fx_M8K_mangleFM18walk_ktyp_n_mangleN14K_form__ktyp_t3N14K_form__ktyp_tR10Ast__loc_tR17K_form__k_callb_t);
   FX_COPY_PTR(arg0, &fcv->t0);
   FX_COPY_PTR(arg1, &fcv->t1);
   fcv->t2 = arg2;
   FX_COPY_PTR(arg3, &fcv->t3);
   return 0;
}

static int
   _fx_M8K_mangleFM13mangle_id_typN14K_form__ktyp_t7R9Ast__id_tR10Ast__loc_tR17K_form__k_callb_trirLN14K_form__kexp_tBNt10Hashmap__t2SR9Ast__id_t(
   struct _fx_R9Ast__id_t* i_0,
   struct _fx_R10Ast__loc_t* loc_0,
   struct _fx_R17K_form__k_callb_t* callb_0,
   struct _fx_ri_data_t* curr_km_idx_ref_0,
   struct _fx_rLN14K_form__kexp_t_data_t* curr_top_code_ref_0,
   bool final_mode_0,
   struct _fx_Nt10Hashmap__t2SR9Ast__id_t_data_t* mangle_map_0,
   struct _fx_N14K_form__ktyp_t_data_t** fx_result,
   void* fx_fv)
{
   _fx_FPN14K_form__ktyp_t3N14K_form__ktyp_tR10Ast__loc_tR17K_form__k_callb_t walk_ktyp_n_mangle_0 = {0};
   _fx_N15K_form__kinfo_t v_0 = {0};
   int fx_status = 0;
   _fx_M8K_mangleFM13mangle_id_typN14K_form__ktyp_t7R9Ast__id_tR10Ast__loc_tR17K_form__k_callb_trirLN14K_form__kexp_tBNt10Hashmap__t2SR9Ast__id_t_cldata_t*
      cv_0 =
      (_fx_M8K_mangleFM13mangle_id_typN14K_form__ktyp_t7R9Ast__id_tR10Ast__loc_tR17K_form__k_callb_trirLN14K_form__kexp_tBNt10Hashmap__t2SR9Ast__id_t_cldata_t*)
         fx_fv;
   _fx_M8K_mangleFM7make_fpFPN14K_form__ktyp_t3N14K_form__ktyp_tR10Ast__loc_tR17K_form__k_callb_t4rirLN14K_form__kexp_tBNt10Hashmap__t2SR9Ast__id_t(
      cv_0->t0, cv_0->t1, cv_0->t2, cv_0->t3, &walk_ktyp_n_mangle_0);
   bool res_0;
   FX_CALL(_fx_M3AstFM6__eq__B2RM4id_tRM4id_t(i_0, &_fx_g9Ast__noid, &res_0, 0), _fx_cleanup);
   if (!res_0) {
      FX_CALL(_fx_M6K_formFM6kinfo_N15K_form__kinfo_t2R9Ast__id_tR10Ast__loc_t(i_0, loc_0, &v_0, 0), _fx_cleanup);
      if (v_0.tag == 2) {
         _fx_R16Ast__val_flags_t kv_flags_0 = {0};
         fx_str_t kv_cname_0 = {0};
         _fx_N14K_form__ktyp_t kv_typ_0 = 0;
         _fx_N14K_form__ktyp_t t_0 = 0;
         _fx_LN12Ast__scope_t v_1 = 0;
         fx_str_t cname_0 = {0};
         _fx_N14K_form__ktyp_t v_2 = 0;
         _fx_R17K_form__kdefval_t v_3 = {0};
         _fx_N15K_form__kinfo_t v_4 = {0};
         _fx_R17K_form__kdefval_t* kv_0 = &v_0.u.KVal;
         _fx_copy_R16Ast__val_flags_t(&kv_0->kv_flags, &kv_flags_0);
         fx_copy_str(&kv_0->kv_cname, &kv_cname_0);
         FX_COPY_PTR(kv_0->kv_typ, &kv_typ_0);
         FX_CALL(walk_ktyp_n_mangle_0.fp(kv_typ_0, loc_0, callb_0, &t_0, walk_ktyp_n_mangle_0.fcv), _fx_catch_2);
         if (FX_STR_LENGTH(kv_cname_0) == 0) {
            FX_CALL(_fx_M6K_formFM13get_val_scopeLN12Ast__scope_t1R16Ast__val_flags_t(&kv_flags_0, &v_1, 0), _fx_catch_2);
            if (v_1 != 0) {
               if (v_1->hd.tag == 1) {
                  fx_str_t slit_0 = FX_MAKE_STR(""); fx_copy_str(&slit_0, &cname_0); goto _fx_endmatch_0;
               }
            }
            _fx_Nt6option1LN12Ast__scope_t v_5 = {0};
            _fx_LN12Ast__scope_t sc_0 = 0;
            fx_str_t prefix_0 = {0};
            fx_str_t nstr_0 = {0};
            fx_str_t bare_name_0 = {0};
            _fx_Ta2S v_6 = {0};
            _fx_M8K_mangleFM4SomeNt6option1LN12Ast__scope_t1LN12Ast__scope_t(v_1, &v_5);
            if (v_5.tag == 2) {
               FX_COPY_PTR(v_5.u.Some, &sc_0);
            }
            else {
               _fx_N15K_form__kinfo_t v_7 = {0};
               FX_CALL(_fx_M6K_formFM6kinfo_N15K_form__kinfo_t2R9Ast__id_tR10Ast__loc_t(i_0, loc_0, &v_7, 0), _fx_catch_0);
               FX_CALL(_fx_M6K_formFM10get_kscopeLN12Ast__scope_t1N15K_form__kinfo_t(&v_7, &sc_0, 0), _fx_catch_0);

            _fx_catch_0: ;
               _fx_free_N15K_form__kinfo_t(&v_7);
            }
            FX_CHECK_EXN(_fx_catch_1);
            fx_str_t slit_1 = FX_MAKE_STR("");
            FX_CALL(_fx_M8K_mangleFM12mangle_scopeS3LN12Ast__scope_tSR10Ast__loc_t(sc_0, &slit_1, loc_0, &prefix_0, 0),
               _fx_catch_1);
            FX_CALL(_fx_M3AstFM2ppS1RM4id_t(i_0, &nstr_0, 0), _fx_catch_1);
            if (FX_STR_LENGTH(prefix_0) == 0) {
               fx_copy_str(&nstr_0, &bare_name_0);
            }
            else {
               fx_str_t slit_2 = FX_MAKE_STR("__");
               {
                  const fx_str_t strs_0[] = { prefix_0, slit_2, nstr_0 };
                  FX_CALL(fx_strjoin(0, 0, 0, strs_0, 3, &bare_name_0), _fx_catch_1);
               }
            }
            fx_str_t slit_3 = FX_MAKE_STR("_fx_g");
            fx_str_t slit_4 = FX_MAKE_STR("");
            FX_CALL(
               _fx_M8K_mangleFM18mangle_make_uniqueTa2S5R9Ast__id_tSSSNt10Hashmap__t2SR9Ast__id_t(i_0, &slit_3, &bare_name_0,
                  &slit_4, mangle_map_0, &v_6, 0), _fx_catch_1);
            fx_copy_str(&v_6.t1, &cname_0);

         _fx_catch_1: ;
            _fx_free_Ta2S(&v_6);
            FX_FREE_STR(&bare_name_0);
            FX_FREE_STR(&nstr_0);
            FX_FREE_STR(&prefix_0);
            FX_FREE_LIST_SIMPLE(&sc_0);
            _fx_free_Nt6option1LN12Ast__scope_t(&v_5);

         _fx_endmatch_0: ;
            FX_CHECK_EXN(_fx_catch_2);
            if (final_mode_0) {
               FX_COPY_PTR(t_0, &v_2);
            }
            else {
               FX_COPY_PTR(kv_typ_0, &v_2);
            }
            _fx_make_R17K_form__kdefval_t(&kv_0->kv_name, &cname_0, v_2, &kv_0->kv_flags, &kv_0->kv_loc, &v_3);
            _fx_M6K_formFM4KValN15K_form__kinfo_t1RM9kdefval_t(&v_3, &v_4);
            FX_CALL(_fx_M6K_formFM13set_idk_entryv2R9Ast__id_tN15K_form__kinfo_t(i_0, &v_4, 0), _fx_catch_2);
         }
         FX_COPY_PTR(t_0, fx_result);

      _fx_catch_2: ;
         _fx_free_N15K_form__kinfo_t(&v_4);
         _fx_free_R17K_form__kdefval_t(&v_3);
         if (v_2) {
            _fx_free_N14K_form__ktyp_t(&v_2);
         }
         FX_FREE_STR(&cname_0);
         FX_FREE_LIST_SIMPLE(&v_1);
         if (t_0) {
            _fx_free_N14K_form__ktyp_t(&t_0);
         }
         if (kv_typ_0) {
            _fx_free_N14K_form__ktyp_t(&kv_typ_0);
         }
         FX_FREE_STR(&kv_cname_0);
         _fx_free_R16Ast__val_flags_t(&kv_flags_0);
      }
      else {
         _fx_N14K_form__ktyp_t v_8 = 0;
         FX_CALL(_fx_M6K_formFM12get_idk_ktypN14K_form__ktyp_t2R9Ast__id_tR10Ast__loc_t(i_0, loc_0, &v_8, 0), _fx_catch_3);
         FX_CALL(walk_ktyp_n_mangle_0.fp(v_8, loc_0, callb_0, fx_result, walk_ktyp_n_mangle_0.fcv), _fx_catch_3);

      _fx_catch_3: ;
         if (v_8) {
            _fx_free_N14K_form__ktyp_t(&v_8);
         }
      }
      FX_CHECK_EXN(_fx_cleanup);
   }
   else {
      FX_COPY_PTR(_fx_g18K_mangle__KTypVoid, fx_result);
   }

_fx_cleanup: ;
   FX_FREE_FP(&walk_ktyp_n_mangle_0);
   _fx_free_N15K_form__kinfo_t(&v_0);
   return fx_status;
}

FX_EXTERN_C int
   _fx_M8K_mangleFM7make_fpFPN14K_form__ktyp_t7R9Ast__id_tR10Ast__loc_tR17K_form__k_callb_trirLN14K_form__kexp_tBNt10Hashmap__t2SR9Ast__id_t4rirLN14K_form__kexp_tBNt10Hashmap__t2SR9Ast__id_t(
   struct _fx_ri_data_t* arg0,
   struct _fx_rLN14K_form__kexp_t_data_t* arg1,
   bool arg2,
   struct _fx_Nt10Hashmap__t2SR9Ast__id_t_data_t* arg3,
   struct _fx_FPN14K_form__ktyp_t7R9Ast__id_tR10Ast__loc_tR17K_form__k_callb_trirLN14K_form__kexp_tBNt10Hashmap__t2SR9Ast__id_t*
      fx_result)
{
   FX_MAKE_FP_IMPL_START(
      _fx_M8K_mangleFM13mangle_id_typN14K_form__ktyp_t7R9Ast__id_tR10Ast__loc_tR17K_form__k_callb_trirLN14K_form__kexp_tBNt10Hashmap__t2SR9Ast__id_t_cldata_t,
      _fx_free_M8K_mangleFM13mangle_id_typN14K_form__ktyp_t7R9Ast__id_tR10Ast__loc_tR17K_form__k_callb_trirLN14K_form__kexp_tBNt10Hashmap__t2SR9Ast__id_t,
      _fx_M8K_mangleFM13mangle_id_typN14K_form__ktyp_t7R9Ast__id_tR10Ast__loc_tR17K_form__k_callb_trirLN14K_form__kexp_tBNt10Hashmap__t2SR9Ast__id_t);
   FX_COPY_PTR(arg0, &fcv->t0);
   FX_COPY_PTR(arg1, &fcv->t1);
   fcv->t2 = arg2;
   FX_COPY_PTR(arg3, &fcv->t3);
   return 0;
}

static int
   _fx_M8K_mangleFM25mangle_ktyp_retain_recordN14K_form__ktyp_t7N14K_form__ktyp_tR10Ast__loc_tR17K_form__k_callb_trirLN14K_form__kexp_tBNt10Hashmap__t2SR9Ast__id_t(
   struct _fx_N14K_form__ktyp_t_data_t* t_0,
   struct _fx_R10Ast__loc_t* loc_0,
   struct _fx_R17K_form__k_callb_t* callb_0,
   struct _fx_ri_data_t* curr_km_idx_ref_0,
   struct _fx_rLN14K_form__kexp_t_data_t* curr_top_code_ref_0,
   bool final_mode_0,
   struct _fx_Nt10Hashmap__t2SR9Ast__id_t_data_t* mangle_map_0,
   struct _fx_N14K_form__ktyp_t_data_t** fx_result,
   void* fx_fv)
{
   _fx_FPN14K_form__ktyp_t3N14K_form__ktyp_tR10Ast__loc_tR17K_form__k_callb_t walk_ktyp_n_mangle_0 = {0};
   int fx_status = 0;
   _fx_M8K_mangleFM25mangle_ktyp_retain_recordN14K_form__ktyp_t7N14K_form__ktyp_tR10Ast__loc_tR17K_form__k_callb_trirLN14K_form__kexp_tBNt10Hashmap__t2SR9Ast__id_t_cldata_t*
      cv_0 =
      (_fx_M8K_mangleFM25mangle_ktyp_retain_recordN14K_form__ktyp_t7N14K_form__ktyp_tR10Ast__loc_tR17K_form__k_callb_trirLN14K_form__kexp_tBNt10Hashmap__t2SR9Ast__id_t_cldata_t*)
         fx_fv;
   _fx_M8K_mangleFM7make_fpFPN14K_form__ktyp_t3N14K_form__ktyp_tR10Ast__loc_tR17K_form__k_callb_t4rirLN14K_form__kexp_tBNt10Hashmap__t2SR9Ast__id_t(
      cv_0->t0, cv_0->t1, cv_0->t2, cv_0->t3, &walk_ktyp_n_mangle_0);
   if (FX_REC_VARIANT_TAG(t_0) == 15) {
      _fx_LT2R9Ast__id_tN14K_form__ktyp_t v_0 = 0;
      _fx_LT2R9Ast__id_tN14K_form__ktyp_t relems_0 = 0;
      _fx_T2R9Ast__id_tLT2R9Ast__id_tN14K_form__ktyp_t* vcase_0 = &t_0->u.KTypRecord;
      _fx_LT2R9Ast__id_tN14K_form__ktyp_t lstend_0 = 0;
      FX_COPY_PTR(vcase_0->t1, &relems_0);
      _fx_LT2R9Ast__id_tN14K_form__ktyp_t lst_0 = relems_0;
      for (; lst_0; lst_0 = lst_0->tl) {
         _fx_N14K_form__ktyp_t ti_0 = 0;
         _fx_N14K_form__ktyp_t v_1 = 0;
         _fx_T2R9Ast__id_tN14K_form__ktyp_t tup_0 = {0};
         _fx_T2R9Ast__id_tN14K_form__ktyp_t* __pat___0 = &lst_0->hd;
         _fx_R9Ast__id_t ni_0 = __pat___0->t0;
         FX_COPY_PTR(__pat___0->t1, &ti_0);
         FX_CALL(walk_ktyp_n_mangle_0.fp(ti_0, loc_0, callb_0, &v_1, walk_ktyp_n_mangle_0.fcv), _fx_catch_0);
         _fx_make_T2R9Ast__id_tN14K_form__ktyp_t(&ni_0, v_1, &tup_0);
         _fx_LT2R9Ast__id_tN14K_form__ktyp_t node_0 = 0;
         FX_CALL(_fx_cons_LT2R9Ast__id_tN14K_form__ktyp_t(&tup_0, 0, false, &node_0), _fx_catch_0);
         FX_LIST_APPEND(v_0, lstend_0, node_0);

      _fx_catch_0: ;
         _fx_free_T2R9Ast__id_tN14K_form__ktyp_t(&tup_0);
         if (v_1) {
            _fx_free_N14K_form__ktyp_t(&v_1);
         }
         if (ti_0) {
            _fx_free_N14K_form__ktyp_t(&ti_0);
         }
         FX_CHECK_EXN(_fx_catch_1);
      }
      FX_CALL(
         _fx_M6K_formFM10KTypRecordN14K_form__ktyp_t2R9Ast__id_tLT2R9Ast__id_tN14K_form__ktyp_t(&vcase_0->t0, v_0, fx_result),
         _fx_catch_1);

   _fx_catch_1: ;
      if (relems_0) {
         _fx_free_LT2R9Ast__id_tN14K_form__ktyp_t(&relems_0);
      }
      if (v_0) {
         _fx_free_LT2R9Ast__id_tN14K_form__ktyp_t(&v_0);
      }
   }
   else {
      FX_CALL(walk_ktyp_n_mangle_0.fp(t_0, loc_0, callb_0, fx_result, walk_ktyp_n_mangle_0.fcv), _fx_catch_2);  _fx_catch_2: ;
   }
   FX_FREE_FP(&walk_ktyp_n_mangle_0);
   return fx_status;
}

FX_EXTERN_C int
   _fx_M8K_mangleFM7make_fpFPN14K_form__ktyp_t7N14K_form__ktyp_tR10Ast__loc_tR17K_form__k_callb_trirLN14K_form__kexp_tBNt10Hashmap__t2SR9Ast__id_t4rirLN14K_form__kexp_tBNt10Hashmap__t2SR9Ast__id_t(
   struct _fx_ri_data_t* arg0,
   struct _fx_rLN14K_form__kexp_t_data_t* arg1,
   bool arg2,
   struct _fx_Nt10Hashmap__t2SR9Ast__id_t_data_t* arg3,
   struct _fx_FPN14K_form__ktyp_t7N14K_form__ktyp_tR10Ast__loc_tR17K_form__k_callb_trirLN14K_form__kexp_tBNt10Hashmap__t2SR9Ast__id_t*
      fx_result)
{
   FX_MAKE_FP_IMPL_START(
      _fx_M8K_mangleFM25mangle_ktyp_retain_recordN14K_form__ktyp_t7N14K_form__ktyp_tR10Ast__loc_tR17K_form__k_callb_trirLN14K_form__kexp_tBNt10Hashmap__t2SR9Ast__id_t_cldata_t,
      _fx_free_M8K_mangleFM25mangle_ktyp_retain_recordN14K_form__ktyp_t7N14K_form__ktyp_tR10Ast__loc_tR17K_form__k_callb_trirLN14K_form__kexp_tBNt10Hashmap__t2SR9Ast__id_t,
      _fx_M8K_mangleFM25mangle_ktyp_retain_recordN14K_form__ktyp_t7N14K_form__ktyp_tR10Ast__loc_tR17K_form__k_callb_trirLN14K_form__kexp_tBNt10Hashmap__t2SR9Ast__id_t);
   FX_COPY_PTR(arg0, &fcv->t0);
   FX_COPY_PTR(arg1, &fcv->t1);
   fcv->t2 = arg2;
   FX_COPY_PTR(arg3, &fcv->t3);
   return 0;
}

static int
   _fx_M8K_mangleFM12mangle_idomlv8LT2R9Ast__id_tN13K_form__dom_tLR9Ast__id_tR10Ast__loc_tR17K_form__k_callb_trirLN14K_form__kexp_tBNt10Hashmap__t2SR9Ast__id_t(
   struct _fx_LT2R9Ast__id_tN13K_form__dom_t_data_t* idoml_0,
   struct _fx_LR9Ast__id_t_data_t* at_ids_0,
   struct _fx_R10Ast__loc_t* loc_0,
   struct _fx_R17K_form__k_callb_t* callb_0,
   struct _fx_ri_data_t* curr_km_idx_ref_0,
   struct _fx_rLN14K_form__kexp_t_data_t* curr_top_code_ref_0,
   bool final_mode_0,
   struct _fx_Nt10Hashmap__t2SR9Ast__id_t_data_t* mangle_map_0,
   void* fx_fv)
{
   _fx_FPN14K_form__ktyp_t7R9Ast__id_tR10Ast__loc_tR17K_form__k_callb_trirLN14K_form__kexp_tBNt10Hashmap__t2SR9Ast__id_t
      mangle_id_typ_0 = {0};
   int fx_status = 0;
   _fx_M8K_mangleFM12mangle_idomlv8LT2R9Ast__id_tN13K_form__dom_tLR9Ast__id_tR10Ast__loc_tR17K_form__k_callb_trirLN14K_form__kexp_tBNt10Hashmap__t2SR9Ast__id_t_cldata_t*
      cv_0 =
      (_fx_M8K_mangleFM12mangle_idomlv8LT2R9Ast__id_tN13K_form__dom_tLR9Ast__id_tR10Ast__loc_tR17K_form__k_callb_trirLN14K_form__kexp_tBNt10Hashmap__t2SR9Ast__id_t_cldata_t*)
         fx_fv;
   _fx_M8K_mangleFM7make_fpFPN14K_form__ktyp_t7R9Ast__id_tR10Ast__loc_tR17K_form__k_callb_trirLN14K_form__kexp_tBNt10Hashmap__t2SR9Ast__id_t4rirLN14K_form__kexp_tBNt10Hashmap__t2SR9Ast__id_t(
      cv_0->t0, cv_0->t1, cv_0->t2, cv_0->t3, &mangle_id_typ_0);
   _fx_LR9Ast__id_t lst_0 = at_ids_0;
   for (; lst_0; lst_0 = lst_0->tl) {
      _fx_N14K_form__ktyp_t res_0 = 0;
      _fx_R9Ast__id_t* i_0 = &lst_0->hd;
      FX_CALL(
         mangle_id_typ_0.fp(i_0, loc_0, callb_0, curr_km_idx_ref_0, curr_top_code_ref_0, final_mode_0, mangle_map_0, &res_0,
            mangle_id_typ_0.fcv), _fx_catch_0);

   _fx_catch_0: ;
      if (res_0) {
         _fx_free_N14K_form__ktyp_t(&res_0);
      }
      FX_CHECK_EXN(_fx_cleanup);
   }
   _fx_LT2R9Ast__id_tN13K_form__dom_t lst_1 = idoml_0;
   for (; lst_1; lst_1 = lst_1->tl) {
      _fx_N14K_form__ktyp_t res_1 = 0;
      _fx_T2R9Ast__id_tN13K_form__dom_t* __pat___0 = &lst_1->hd;
      _fx_R9Ast__id_t k_0 = __pat___0->t0;
      FX_CALL(
         mangle_id_typ_0.fp(&k_0, loc_0, callb_0, curr_km_idx_ref_0, curr_top_code_ref_0, final_mode_0, mangle_map_0, &res_1,
            mangle_id_typ_0.fcv), _fx_catch_1);

   _fx_catch_1: ;
      if (res_1) {
         _fx_free_N14K_form__ktyp_t(&res_1);
      }
      FX_CHECK_EXN(_fx_cleanup);
   }

_fx_cleanup: ;
   FX_FREE_FP(&mangle_id_typ_0);
   return fx_status;
}

FX_EXTERN_C int
   _fx_M8K_mangleFM7make_fpFPv8LT2R9Ast__id_tN13K_form__dom_tLR9Ast__id_tR10Ast__loc_tR17K_form__k_callb_trirLN14K_form__kexp_tBNt10Hashmap__t2SR9Ast__id_t4rirLN14K_form__kexp_tBNt10Hashmap__t2SR9Ast__id_t(
   struct _fx_ri_data_t* arg0,
   struct _fx_rLN14K_form__kexp_t_data_t* arg1,
   bool arg2,
   struct _fx_Nt10Hashmap__t2SR9Ast__id_t_data_t* arg3,
   struct _fx_FPv8LT2R9Ast__id_tN13K_form__dom_tLR9Ast__id_tR10Ast__loc_tR17K_form__k_callb_trirLN14K_form__kexp_tBNt10Hashmap__t2SR9Ast__id_t*
      fx_result)
{
   FX_MAKE_FP_IMPL_START(
      _fx_M8K_mangleFM12mangle_idomlv8LT2R9Ast__id_tN13K_form__dom_tLR9Ast__id_tR10Ast__loc_tR17K_form__k_callb_trirLN14K_form__kexp_tBNt10Hashmap__t2SR9Ast__id_t_cldata_t,
      _fx_free_M8K_mangleFM12mangle_idomlv8LT2R9Ast__id_tN13K_form__dom_tLR9Ast__id_tR10Ast__loc_tR17K_form__k_callb_trirLN14K_form__kexp_tBNt10Hashmap__t2SR9Ast__id_t,
      _fx_M8K_mangleFM12mangle_idomlv8LT2R9Ast__id_tN13K_form__dom_tLR9Ast__id_tR10Ast__loc_tR17K_form__k_callb_trirLN14K_form__kexp_tBNt10Hashmap__t2SR9Ast__id_t);
   FX_COPY_PTR(arg0, &fcv->t0);
   FX_COPY_PTR(arg1, &fcv->t1);
   fcv->t2 = arg2;
   FX_COPY_PTR(arg3, &fcv->t3);
   return 0;
}

static int _fx_M8K_mangleFM18walk_kexp_n_mangleN14K_form__kexp_t2N14K_form__kexp_tR17K_form__k_callb_t(
   struct _fx_N14K_form__kexp_t_data_t* e_0,
   struct _fx_R17K_form__k_callb_t* callb_0,
   struct _fx_N14K_form__kexp_t_data_t** fx_result,
   void* fx_fv)
{
   _fx_FPN14K_form__ktyp_t7R9Ast__id_tR10Ast__loc_tR17K_form__k_callb_trirLN14K_form__kexp_tBNt10Hashmap__t2SR9Ast__id_t
      mangle_id_typ_0 = {0};
   _fx_FPN14K_form__ktyp_t3N14K_form__ktyp_tR10Ast__loc_tR17K_form__k_callb_t walk_ktyp_n_mangle_0 = {0};
   _fx_FPN14K_form__ktyp_t7N14K_form__ktyp_tR10Ast__loc_tR17K_form__k_callb_trirLN14K_form__kexp_tBNt10Hashmap__t2SR9Ast__id_t
      mangle_ktyp_retain_record_0 = {0};
   _fx_FPv8LT2R9Ast__id_tN13K_form__dom_tLR9Ast__id_tR10Ast__loc_tR17K_form__k_callb_trirLN14K_form__kexp_tBNt10Hashmap__t2SR9Ast__id_t
      mangle_idoml_0 = {0};
   _fx_R17K_form__kdeftyp_t v_0 = {0};
   int fx_status = 0;
   FX_CALL(fx_check_stack(), _fx_cleanup);
   _fx_M8K_mangleFM18walk_kexp_n_mangleN14K_form__kexp_t2N14K_form__kexp_tR17K_form__k_callb_t_cldata_t* cv_0 =
      (_fx_M8K_mangleFM18walk_kexp_n_mangleN14K_form__kexp_t2N14K_form__kexp_tR17K_form__k_callb_t_cldata_t*)fx_fv;
   _fx_ri curr_km_idx_ref_0 = cv_0->t0;
   _fx_rLN14K_form__kexp_t curr_top_code_ref_0 = cv_0->t1;
   bool* final_mode_0 = &cv_0->t2;
   _fx_Nt10Hashmap__t2SR9Ast__id_t mangle_map_0 = cv_0->t3;
   _fx_M8K_mangleFM7make_fpFPN14K_form__ktyp_t7R9Ast__id_tR10Ast__loc_tR17K_form__k_callb_trirLN14K_form__kexp_tBNt10Hashmap__t2SR9Ast__id_t4rirLN14K_form__kexp_tBNt10Hashmap__t2SR9Ast__id_t(
      curr_km_idx_ref_0, curr_top_code_ref_0, *final_mode_0, mangle_map_0, &mangle_id_typ_0);
   _fx_M8K_mangleFM7make_fpFPN14K_form__ktyp_t3N14K_form__ktyp_tR10Ast__loc_tR17K_form__k_callb_t4rirLN14K_form__kexp_tBNt10Hashmap__t2SR9Ast__id_t(
      curr_km_idx_ref_0, curr_top_code_ref_0, *final_mode_0, mangle_map_0, &walk_ktyp_n_mangle_0);
   _fx_M8K_mangleFM7make_fpFPN14K_form__ktyp_t7N14K_form__ktyp_tR10Ast__loc_tR17K_form__k_callb_trirLN14K_form__kexp_tBNt10Hashmap__t2SR9Ast__id_t4rirLN14K_form__kexp_tBNt10Hashmap__t2SR9Ast__id_t(
      curr_km_idx_ref_0, curr_top_code_ref_0, *final_mode_0, mangle_map_0, &mangle_ktyp_retain_record_0);
   _fx_M8K_mangleFM7make_fpFPv8LT2R9Ast__id_tN13K_form__dom_tLR9Ast__id_tR10Ast__loc_tR17K_form__k_callb_trirLN14K_form__kexp_tBNt10Hashmap__t2SR9Ast__id_t4rirLN14K_form__kexp_tBNt10Hashmap__t2SR9Ast__id_t(
      curr_km_idx_ref_0, curr_top_code_ref_0, *final_mode_0, mangle_map_0, &mangle_idoml_0);
   int tag_0 = FX_REC_VARIANT_TAG(e_0);
   if (tag_0 == 31) {
      _fx_N14K_form__kexp_t e_1 = 0;
      _fx_N14K_form__ktyp_t res_0 = 0;
      _fx_T3R9Ast__id_tN14K_form__kexp_tR10Ast__loc_t* vcase_0 = &e_0->u.KDefVal;
      _fx_R10Ast__loc_t* loc_0 = &vcase_0->t2;
      _fx_R9Ast__id_t* n_0 = &vcase_0->t0;
      FX_CALL(
         _fx_M8K_mangleFM18walk_kexp_n_mangleN14K_form__kexp_t2N14K_form__kexp_tR17K_form__k_callb_t(vcase_0->t1, callb_0, &e_1,
            fx_fv), _fx_catch_0);
      FX_CALL(
         mangle_id_typ_0.fp(n_0, loc_0, callb_0, curr_km_idx_ref_0, curr_top_code_ref_0, *final_mode_0, mangle_map_0, &res_0,
            mangle_id_typ_0.fcv), _fx_catch_0);
      FX_CALL(_fx_M6K_formFM7KDefValN14K_form__kexp_t3R9Ast__id_tN14K_form__kexp_tR10Ast__loc_t(n_0, e_1, loc_0, fx_result),
         _fx_catch_0);

   _fx_catch_0: ;
      if (res_0) {
         _fx_free_N14K_form__ktyp_t(&res_0);
      }
      if (e_1) {
         _fx_free_N14K_form__kexp_t(&e_1);
      }
      goto _fx_endmatch_1;
   }
   if (tag_0 == 32) {
      _fx_LN12Ast__scope_t kf_scope_0 = 0;
      _fx_N14K_form__kexp_t kf_body_0 = 0;
      _fx_N14K_form__ktyp_t kf_rt_0 = 0;
      _fx_LR9Ast__id_t kf_params_0 = 0;
      _fx_N14K_form__ktyp_t rt_0 = 0;
      _fx_N14K_form__ktyp_t ktyp_0 = 0;
      fx_str_t suffix_0 = {0};
      fx_str_t suffix_1 = {0};
      _fx_N14K_form__kexp_t new_body_0 = 0;
      _fx_Nt6option1LN12Ast__scope_t v_1 = {0};
      fx_str_t bare_name_0 = {0};
      _fx_Ta2S v_2 = {0};
      fx_str_t cname_0 = {0};
      fx_str_t v_3 = {0};
      fx_str_t cname_1 = {0};
      _fx_N14K_form__ktyp_t mangled_ktyp_0 = 0;
      _fx_N15K_form__kinfo_t v_4 = {0};
      _fx_N14K_form__ktyp_t v_5 = 0;
      _fx_R17K_form__kdeffun_t v_6 = {0};
      _fx_rR17K_form__kdeffun_t kf_0 = e_0->u.KDefFun;
      _fx_R17K_form__kdeffun_t* v_7 = &kf_0->data;
      _fx_R10Ast__loc_t kf_loc_0 = v_7->kf_loc;
      FX_COPY_PTR(v_7->kf_scope, &kf_scope_0);
      _fx_R25K_form__kdefclosureinfo_t kf_closure_0 = v_7->kf_closure;
      FX_COPY_PTR(v_7->kf_body, &kf_body_0);
      FX_COPY_PTR(v_7->kf_rt, &kf_rt_0);
      FX_COPY_PTR(v_7->kf_params, &kf_params_0);
      _fx_R9Ast__id_t kf_name_0 = v_7->kf_name;
      _fx_R9Ast__id_t kci_fcv_t_0 = kf_closure_0.kci_fcv_t;
      _fx_LR9Ast__id_t lst_0 = kf_params_0;
      for (; lst_0; lst_0 = lst_0->tl) {
         _fx_N14K_form__ktyp_t v_8 = 0;
         _fx_R9Ast__id_t* a_0 = &lst_0->hd;
         FX_CALL(
            mangle_id_typ_0.fp(a_0, &kf_loc_0, callb_0, curr_km_idx_ref_0, curr_top_code_ref_0, *final_mode_0, mangle_map_0,
               &v_8, mangle_id_typ_0.fcv), _fx_catch_1);
         FX_CALL(_fx_M8K_mangleFM6ignorev1N14K_form__ktyp_t(v_8, 0), _fx_catch_1);

      _fx_catch_1: ;
         if (v_8) {
            _fx_free_N14K_form__ktyp_t(&v_8);
         }
         FX_CHECK_EXN(_fx_catch_6);
      }
      FX_CALL(walk_ktyp_n_mangle_0.fp(kf_rt_0, &kf_loc_0, callb_0, &rt_0, walk_ktyp_n_mangle_0.fcv), _fx_catch_6);
      FX_CALL(
         _fx_M6K_formFM10get_kf_typN14K_form__ktyp_t3LR9Ast__id_tN14K_form__ktyp_tR10Ast__loc_t(kf_params_0, rt_0, &kf_loc_0,
            &ktyp_0, 0), _fx_catch_6);
      FX_CALL(
         _fx_M8K_mangleFM11mangle_ktypS3N14K_form__ktyp_tNt10Hashmap__t2SR9Ast__id_tR10Ast__loc_t(ktyp_0, mangle_map_0,
            &kf_loc_0, &suffix_0, 0), _fx_catch_6);
      FX_CALL(fx_substr(&suffix_0, 2, 0, 1, 2, &suffix_1), _fx_catch_6);
      FX_CALL(
         _fx_M8K_mangleFM18walk_kexp_n_mangleN14K_form__kexp_t2N14K_form__kexp_tR17K_form__k_callb_t(kf_body_0, callb_0,
            &new_body_0, fx_fv), _fx_catch_6);
      _fx_M8K_mangleFM4SomeNt6option1LN12Ast__scope_t1LN12Ast__scope_t(kf_scope_0, &v_1);
      FX_CALL(
         _fx_M8K_mangleFM11mangle_nameS3R9Ast__id_tNt6option1LN12Ast__scope_tR10Ast__loc_t(&kf_name_0, &v_1, &kf_loc_0,
            &bare_name_0, 0), _fx_catch_6);
      fx_str_t slit_0 = FX_MAKE_STR("F");
      FX_CALL(
         _fx_M8K_mangleFM18mangle_make_uniqueTa2S5R9Ast__id_tSSSNt10Hashmap__t2SR9Ast__id_t(&kf_name_0, &slit_0, &bare_name_0,
            &suffix_1, mangle_map_0, &v_2, 0), _fx_catch_6);
      fx_copy_str(&v_2.t1, &cname_0);
      FX_CALL(_fx_M8K_mangleFM13compress_nameS3SLN12Ast__scope_tR10Ast__loc_t(&cname_0, kf_scope_0, &kf_loc_0, &v_3, 0),
         _fx_catch_6);
      FX_CALL(_fx_M8K_mangleFM6add_fxS1S(&v_3, &cname_1, 0), _fx_catch_6);
      FX_CALL(walk_ktyp_n_mangle_0.fp(ktyp_0, &kf_loc_0, callb_0, &mangled_ktyp_0, walk_ktyp_n_mangle_0.fcv), _fx_catch_6);
      _fx_R9Ast__id_t mangled_ktyp_id_0;
      if (FX_REC_VARIANT_TAG(mangled_ktyp_0) == 16) {
         mangled_ktyp_id_0 = mangled_ktyp_0->u.KTypName;
      }
      else {
         fx_str_t v_9 = {0};
         fx_str_t v_10 = {0};
         fx_exn_t v_11 = {0};
         if (!*final_mode_0) {
            mangled_ktyp_id_0 = _fx_g9Ast__noid;
         }
         else {
            FX_CALL(_fx_M8K_mangleFM6stringS1S(&cname_1, &v_9, 0), _fx_catch_2);
            fx_str_t slit_1 = FX_MAKE_STR("mangle: cannot mangle \'");
            fx_str_t slit_2 = FX_MAKE_STR("\' type down to alias");
            {
               const fx_str_t strs_0[] = { slit_1, v_9, slit_2 };
               FX_CALL(fx_strjoin(0, 0, 0, strs_0, 3, &v_10), _fx_catch_2);
            }
            FX_CALL(_fx_M3AstFM11compile_errE2RM5loc_tS(&kf_loc_0, &v_10, &v_11, 0), _fx_catch_2);
            FX_THROW(&v_11, false, _fx_catch_2);
         }

      _fx_catch_2: ;
         fx_free_exn(&v_11);
         FX_FREE_STR(&v_10);
         FX_FREE_STR(&v_9);
      }
      FX_CHECK_EXN(_fx_catch_6);
      bool res_1;
      FX_CALL(_fx_M8K_mangleFM6__ne__B2R9Ast__id_tR9Ast__id_t(&kci_fcv_t_0, &_fx_g9Ast__noid, &res_1, 0), _fx_catch_6);
      if (res_1) {
         FX_CALL(_fx_M6K_formFM6kinfo_N15K_form__kinfo_t2R9Ast__id_tR10Ast__loc_t(&kci_fcv_t_0, &kf_loc_0, &v_4, 0),
            _fx_catch_6);
         if (v_4.tag == 6) {
            _fx_LT2R9Ast__id_tN14K_form__ktyp_t kcv_freevars_0 = 0;
            fx_str_t cv_cname_0 = {0};
            _fx_LT2R9Ast__id_tN14K_form__ktyp_t freevars_0 = 0;
            _fx_LT2R9Ast__id_tN14K_form__ktyp_t v_12 = 0;
            _fx_R25K_form__kdefclosurevars_t v_13 = {0};
            _fx_rR25K_form__kdefclosurevars_t kcv_0 = v_4.u.KClosureVars;
            _fx_R25K_form__kdefclosurevars_t* v_14 = &kcv_0->data;
            _fx_R10Ast__loc_t kcv_loc_0 = v_14->kcv_loc;
            FX_COPY_PTR(v_14->kcv_freevars, &kcv_freevars_0);
            fx_str_t slit_3 = FX_MAKE_STR("_cldata_t");
            {
               const fx_str_t strs_1[] = { cname_1, slit_3 };
               FX_CALL(fx_strjoin(0, 0, 0, strs_1, 2, &cv_cname_0), _fx_catch_4);
            }
            _fx_LT2R9Ast__id_tN14K_form__ktyp_t lstend_0 = 0;
            _fx_LT2R9Ast__id_tN14K_form__ktyp_t lst_1 = kcv_freevars_0;
            for (; lst_1; lst_1 = lst_1->tl) {
               _fx_N14K_form__ktyp_t t_0 = 0;
               _fx_N14K_form__ktyp_t v_15 = 0;
               _fx_T2R9Ast__id_tN14K_form__ktyp_t tup_0 = {0};
               _fx_T2R9Ast__id_tN14K_form__ktyp_t* __pat___0 = &lst_1->hd;
               _fx_R9Ast__id_t n_1 = __pat___0->t0;
               FX_COPY_PTR(__pat___0->t1, &t_0);
               FX_CALL(walk_ktyp_n_mangle_0.fp(t_0, &kcv_loc_0, callb_0, &v_15, walk_ktyp_n_mangle_0.fcv), _fx_catch_3);
               _fx_make_T2R9Ast__id_tN14K_form__ktyp_t(&n_1, v_15, &tup_0);
               _fx_LT2R9Ast__id_tN14K_form__ktyp_t node_0 = 0;
               FX_CALL(_fx_cons_LT2R9Ast__id_tN14K_form__ktyp_t(&tup_0, 0, false, &node_0), _fx_catch_3);
               FX_LIST_APPEND(freevars_0, lstend_0, node_0);

            _fx_catch_3: ;
               _fx_free_T2R9Ast__id_tN14K_form__ktyp_t(&tup_0);
               if (v_15) {
                  _fx_free_N14K_form__ktyp_t(&v_15);
               }
               if (t_0) {
                  _fx_free_N14K_form__ktyp_t(&t_0);
               }
               FX_CHECK_EXN(_fx_catch_4);
            }
            _fx_R25K_form__kdefclosurevars_t* v_16 = &kcv_0->data;
            if (*final_mode_0) {
               FX_COPY_PTR(freevars_0, &v_12);
            }
            else {
               FX_COPY_PTR(kcv_freevars_0, &v_12);
            }
            _fx_make_R25K_form__kdefclosurevars_t(&v_16->kcv_name, &cv_cname_0, v_12, v_16->kcv_orig_freevars, v_16->kcv_scope,
               &v_16->kcv_loc, &v_13);
            _fx_R25K_form__kdefclosurevars_t* v_17 = &kcv_0->data;
            _fx_free_R25K_form__kdefclosurevars_t(v_17);
            _fx_copy_R25K_form__kdefclosurevars_t(&v_13, v_17);

         _fx_catch_4: ;
            _fx_free_R25K_form__kdefclosurevars_t(&v_13);
            if (v_12) {
               _fx_free_LT2R9Ast__id_tN14K_form__ktyp_t(&v_12);
            }
            if (freevars_0) {
               _fx_free_LT2R9Ast__id_tN14K_form__ktyp_t(&freevars_0);
            }
            FX_FREE_STR(&cv_cname_0);
            if (kcv_freevars_0) {
               _fx_free_LT2R9Ast__id_tN14K_form__ktyp_t(&kcv_freevars_0);
            }
         }
         else {
            fx_exn_t v_18 = {0};
            fx_str_t slit_4 = FX_MAKE_STR("mangle: invalid closure datatype (should be KClosureVars)");
            FX_CALL(_fx_M3AstFM11compile_errE2RM5loc_tS(&kf_loc_0, &slit_4, &v_18, 0), _fx_catch_5);
            FX_THROW(&v_18, false, _fx_catch_5);

         _fx_catch_5: ;
            fx_free_exn(&v_18);
         }
         FX_CHECK_EXN(_fx_catch_6);
      }
      _fx_R17K_form__kdeffun_t* v_19 = &kf_0->data;
      if (*final_mode_0) {
         FX_COPY_PTR(rt_0, &v_5);
      }
      else {
         FX_COPY_PTR(kf_rt_0, &v_5);
      }
      _fx_R25K_form__kdefclosureinfo_t v_20;
      if (*final_mode_0) {
         _fx_R25K_form__kdefclosureinfo_t rec_0 =
            { kf_closure_0.kci_arg, kf_closure_0.kci_fcv_t, mangled_ktyp_id_0, kf_closure_0.kci_make_fp, kf_closure_0.kci_wrap_f
            };
         v_20 = rec_0;
      }
      else {
         v_20 = kf_closure_0;
      }
      _fx_make_R17K_form__kdeffun_t(&v_19->kf_name, &cname_1, v_19->kf_params, v_5, new_body_0, &v_19->kf_flags, &v_20,
         v_19->kf_scope, &v_19->kf_loc, &v_6);
      _fx_R17K_form__kdeffun_t* v_21 = &kf_0->data;
      _fx_free_R17K_form__kdeffun_t(v_21);
      _fx_copy_R17K_form__kdeffun_t(&v_6, v_21);
      FX_COPY_PTR(e_0, fx_result);

   _fx_catch_6: ;
      _fx_free_R17K_form__kdeffun_t(&v_6);
      if (v_5) {
         _fx_free_N14K_form__ktyp_t(&v_5);
      }
      _fx_free_N15K_form__kinfo_t(&v_4);
      if (mangled_ktyp_0) {
         _fx_free_N14K_form__ktyp_t(&mangled_ktyp_0);
      }
      FX_FREE_STR(&cname_1);
      FX_FREE_STR(&v_3);
      FX_FREE_STR(&cname_0);
      _fx_free_Ta2S(&v_2);
      FX_FREE_STR(&bare_name_0);
      _fx_free_Nt6option1LN12Ast__scope_t(&v_1);
      if (new_body_0) {
         _fx_free_N14K_form__kexp_t(&new_body_0);
      }
      FX_FREE_STR(&suffix_1);
      FX_FREE_STR(&suffix_0);
      if (ktyp_0) {
         _fx_free_N14K_form__ktyp_t(&ktyp_0);
      }
      if (rt_0) {
         _fx_free_N14K_form__ktyp_t(&rt_0);
      }
      FX_FREE_LIST_SIMPLE(&kf_params_0);
      if (kf_rt_0) {
         _fx_free_N14K_form__ktyp_t(&kf_rt_0);
      }
      if (kf_body_0) {
         _fx_free_N14K_form__kexp_t(&kf_body_0);
      }
      FX_FREE_LIST_SIMPLE(&kf_scope_0);
      goto _fx_endmatch_1;
   }
   if (tag_0 == 33) {
      _fx_LN12Ast__scope_t ke_scope_0 = 0;
      _fx_N14K_form__ktyp_t ke_typ_0 = 0;
      _fx_N14K_form__ktyp_t t_1 = 0;
      fx_str_t suffix_2 = {0};
      _fx_Nt6option1LN12Ast__scope_t v_22 = {0};
      fx_str_t bare_name_1 = {0};
      _fx_Ta2S v_23 = {0};
      fx_str_t base_cname_0 = {0};
      fx_str_t cname_2 = {0};
      fx_str_t exn_cname_0 = {0};
      _fx_N14K_form__ktyp_t v_24 = 0;
      _fx_R17K_form__kdefexn_t v_25 = {0};
      _fx_R17K_form__kdefval_t tag_kv_0 = {0};
      fx_str_t tag_cname_0 = {0};
      fx_str_t v_26 = {0};
      _fx_R17K_form__kdefval_t tag_kv_1 = {0};
      _fx_N15K_form__kinfo_t v_27 = {0};
      _fx_rR17K_form__kdefexn_t ke_0 = e_0->u.KDefExn;
      _fx_R17K_form__kdefexn_t* v_28 = &ke_0->data;
      _fx_R10Ast__loc_t ke_loc_0 = v_28->ke_loc;
      _fx_R9Ast__id_t ke_tag_0 = v_28->ke_tag;
      bool ke_std_0 = v_28->ke_std;
      FX_COPY_PTR(v_28->ke_scope, &ke_scope_0);
      FX_COPY_PTR(v_28->ke_typ, &ke_typ_0);
      _fx_R9Ast__id_t ke_name_0 = v_28->ke_name;
      FX_CALL(
         mangle_ktyp_retain_record_0.fp(ke_typ_0, &ke_loc_0, callb_0, curr_km_idx_ref_0, curr_top_code_ref_0, *final_mode_0,
            mangle_map_0, &t_1, mangle_ktyp_retain_record_0.fcv), _fx_catch_7);
      FX_CALL(
         _fx_M8K_mangleFM11mangle_ktypS3N14K_form__ktyp_tNt10Hashmap__t2SR9Ast__id_tR10Ast__loc_t(t_1, mangle_map_0, &ke_loc_0,
            &suffix_2, 0), _fx_catch_7);
      _fx_M8K_mangleFM4SomeNt6option1LN12Ast__scope_t1LN12Ast__scope_t(ke_scope_0, &v_22);
      FX_CALL(
         _fx_M8K_mangleFM11mangle_nameS3R9Ast__id_tNt6option1LN12Ast__scope_tR10Ast__loc_t(&ke_name_0, &v_22, &ke_loc_0,
            &bare_name_1, 0), _fx_catch_7);
      fx_str_t slit_5 = FX_MAKE_STR("E");
      FX_CALL(
         _fx_M8K_mangleFM18mangle_make_uniqueTa2S5R9Ast__id_tSSSNt10Hashmap__t2SR9Ast__id_t(&ke_name_0, &slit_5, &bare_name_1,
            &suffix_2, mangle_map_0, &v_23, 0), _fx_catch_7);
      fx_copy_str(&v_23.t0, &base_cname_0);
      fx_copy_str(&v_23.t1, &cname_2);
      FX_CALL(_fx_M8K_mangleFM6add_fxS1S(&cname_2, &exn_cname_0, 0), _fx_catch_7);
      _fx_R17K_form__kdefexn_t* v_29 = &ke_0->data;
      if (*final_mode_0) {
         FX_COPY_PTR(t_1, &v_24);
      }
      else {
         FX_COPY_PTR(ke_typ_0, &v_24);
      }
      _fx_make_R17K_form__kdefexn_t(&v_29->ke_name, &exn_cname_0, &base_cname_0, v_24, v_29->ke_std, &v_29->ke_tag,
         &v_29->ke_make, v_29->ke_scope, &v_29->ke_loc, &v_25);
      _fx_R17K_form__kdefexn_t* v_30 = &ke_0->data;
      _fx_free_R17K_form__kdefexn_t(v_30);
      _fx_copy_R17K_form__kdefexn_t(&v_25, v_30);
      FX_CALL(_fx_M6K_formFM8get_kvalRM9kdefval_t2R9Ast__id_tR10Ast__loc_t(&ke_tag_0, &ke_loc_0, &tag_kv_0, 0), _fx_catch_7);
      if (ke_std_0) {
         FX_CALL(_fx_M3AstFM2ppS1RM4id_t(&ke_name_0, &v_26, 0), _fx_catch_7);
         fx_str_t slit_6 = FX_MAKE_STR("FX_EXN_");
         {
            const fx_str_t strs_2[] = { slit_6, v_26 };
            FX_CALL(fx_strjoin(0, 0, 0, strs_2, 2, &tag_cname_0), _fx_catch_7);
         }
      }
      else {
         fx_str_t slit_7 = FX_MAKE_STR("_FX_EXN_");
         {
            const fx_str_t strs_3[] = { slit_7, base_cname_0 };
            FX_CALL(fx_strjoin(0, 0, 0, strs_3, 2, &tag_cname_0), _fx_catch_7);
         }
      }
      _fx_make_R17K_form__kdefval_t(&tag_kv_0.kv_name, &tag_cname_0, tag_kv_0.kv_typ, &tag_kv_0.kv_flags, &tag_kv_0.kv_loc,
         &tag_kv_1);
      _fx_M6K_formFM4KValN15K_form__kinfo_t1RM9kdefval_t(&tag_kv_1, &v_27);
      FX_CALL(_fx_M6K_formFM13set_idk_entryv2R9Ast__id_tN15K_form__kinfo_t(&ke_tag_0, &v_27, 0), _fx_catch_7);
      FX_COPY_PTR(e_0, fx_result);

   _fx_catch_7: ;
      _fx_free_N15K_form__kinfo_t(&v_27);
      _fx_free_R17K_form__kdefval_t(&tag_kv_1);
      FX_FREE_STR(&v_26);
      FX_FREE_STR(&tag_cname_0);
      _fx_free_R17K_form__kdefval_t(&tag_kv_0);
      _fx_free_R17K_form__kdefexn_t(&v_25);
      if (v_24) {
         _fx_free_N14K_form__ktyp_t(&v_24);
      }
      FX_FREE_STR(&exn_cname_0);
      FX_FREE_STR(&cname_2);
      FX_FREE_STR(&base_cname_0);
      _fx_free_Ta2S(&v_23);
      FX_FREE_STR(&bare_name_1);
      _fx_free_Nt6option1LN12Ast__scope_t(&v_22);
      FX_FREE_STR(&suffix_2);
      if (t_1) {
         _fx_free_N14K_form__ktyp_t(&t_1);
      }
      if (ke_typ_0) {
         _fx_free_N14K_form__ktyp_t(&ke_typ_0);
      }
      FX_FREE_LIST_SIMPLE(&ke_scope_0);
      goto _fx_endmatch_1;
   }
   if (tag_0 == 34) {
      _fx_LT2R9Ast__id_tN14K_form__ktyp_t kvar_cases_0 = 0;
      _fx_N14K_form__ktyp_t v_31 = 0;
      fx_str_t res_2 = {0};
      _fx_LT2R9Ast__id_tN14K_form__ktyp_t var_cases_0 = 0;
      _fx_R21K_form__kdefvariant_t v_32 = {0};
      _fx_rR21K_form__kdefvariant_t kvar_0 = e_0->u.KDefVariant;
      _fx_R21K_form__kdefvariant_t* v_33 = &kvar_0->data;
      _fx_R10Ast__loc_t kvar_loc_0 = v_33->kvar_loc;
      FX_COPY_PTR(v_33->kvar_cases, &kvar_cases_0);
      _fx_R9Ast__id_t kvar_name_0 = v_33->kvar_name;
      FX_CALL(_fx_M6K_formFM8KTypNameN14K_form__ktyp_t1R9Ast__id_t(&kvar_name_0, &v_31), _fx_catch_12);
      FX_CALL(
         _fx_M8K_mangleFM11mangle_ktypS3N14K_form__ktyp_tNt10Hashmap__t2SR9Ast__id_tR10Ast__loc_t(v_31, mangle_map_0,
            &kvar_loc_0, &res_2, 0), _fx_catch_12);
      _fx_LT2R9Ast__id_tN14K_form__ktyp_t lstend_1 = 0;
      _fx_LT2R9Ast__id_tN14K_form__ktyp_t lst_2 = kvar_cases_0;
      for (; lst_2; lst_2 = lst_2->tl) {
         _fx_N14K_form__ktyp_t ti_0 = 0;
         _fx_N14K_form__ktyp_t v_34 = 0;
         _fx_N14K_form__ktyp_t ti_1 = 0;
         _fx_N14K_form__ktyp_t v_35 = 0;
         _fx_T2R9Ast__id_tN14K_form__ktyp_t tup_1 = {0};
         _fx_T2R9Ast__id_tN14K_form__ktyp_t* __pat___1 = &lst_2->hd;
         _fx_R9Ast__id_t ni_0 = __pat___1->t0;
         FX_COPY_PTR(__pat___1->t1, &ti_0);
         FX_CALL(_fx_M6K_formFM10deref_ktypN14K_form__ktyp_t2N14K_form__ktyp_tR10Ast__loc_t(ti_0, &kvar_loc_0, &v_34, 0),
            _fx_catch_11);
         if (FX_REC_VARIANT_TAG(v_34) == 15) {
            _fx_T2R9Ast__id_tLT2R9Ast__id_tN14K_form__ktyp_t* vcase_1 = &v_34->u.KTypRecord;
            _fx_LT2R9Ast__id_tN14K_form__ktyp_t relems_0 = vcase_1->t1;
            _fx_R9Ast__id_t* r_id_0 = &vcase_1->t0;
            bool res_3;
            FX_CALL(_fx_M3AstFM6__eq__B2RM4id_tRM4id_t(r_id_0, &_fx_g9Ast__noid, &res_3, 0), _fx_catch_10);
            if (res_3) {
               if (relems_0 != 0) {
                  if (relems_0->tl == 0) {
                     FX_COPY_PTR(relems_0->hd.t1, &ti_1); goto _fx_endmatch_0;
                  }
               }
               _fx_LN14K_form__ktyp_t v_36 = 0;
               _fx_LT2R9Ast__id_tN14K_form__ktyp_t relems_1 = 0;
               _fx_LN14K_form__ktyp_t lstend_2 = 0;
               FX_COPY_PTR(relems_0, &relems_1);
               _fx_LT2R9Ast__id_tN14K_form__ktyp_t lst_3 = relems_1;
               for (; lst_3; lst_3 = lst_3->tl) {
                  _fx_T2R9Ast__id_tN14K_form__ktyp_t* __pat___2 = &lst_3->hd;
                  _fx_LN14K_form__ktyp_t node_1 = 0;
                  FX_CALL(_fx_cons_LN14K_form__ktyp_t(__pat___2->t1, 0, false, &node_1), _fx_catch_8);
                  FX_LIST_APPEND(v_36, lstend_2, node_1);

               _fx_catch_8: ;
                  FX_CHECK_EXN(_fx_catch_9);
               }
               FX_CALL(_fx_M6K_formFM9KTypTupleN14K_form__ktyp_t1LN14K_form__ktyp_t(v_36, &ti_1), _fx_catch_9);

            _fx_catch_9: ;
               if (relems_1) {
                  _fx_free_LT2R9Ast__id_tN14K_form__ktyp_t(&relems_1);
               }
               if (v_36) {
                  _fx_free_LN14K_form__ktyp_t(&v_36);
               }

            _fx_endmatch_0: ;
               FX_CHECK_EXN(_fx_catch_10);
            }
            else {
               FX_CALL(_fx_M6K_formFM8KTypNameN14K_form__ktyp_t1R9Ast__id_t(r_id_0, &ti_1), _fx_catch_10);
            }

         _fx_catch_10: ;
         }
         else {
            FX_COPY_PTR(ti_0, &ti_1);
         }
         FX_CHECK_EXN(_fx_catch_11);
         FX_CALL(
            mangle_ktyp_retain_record_0.fp(ti_1, &kvar_loc_0, callb_0, curr_km_idx_ref_0, curr_top_code_ref_0, *final_mode_0,
               mangle_map_0, &v_35, mangle_ktyp_retain_record_0.fcv), _fx_catch_11);
         _fx_make_T2R9Ast__id_tN14K_form__ktyp_t(&ni_0, v_35, &tup_1);
         _fx_LT2R9Ast__id_tN14K_form__ktyp_t node_2 = 0;
         FX_CALL(_fx_cons_LT2R9Ast__id_tN14K_form__ktyp_t(&tup_1, 0, false, &node_2), _fx_catch_11);
         FX_LIST_APPEND(var_cases_0, lstend_1, node_2);

      _fx_catch_11: ;
         _fx_free_T2R9Ast__id_tN14K_form__ktyp_t(&tup_1);
         if (v_35) {
            _fx_free_N14K_form__ktyp_t(&v_35);
         }
         if (ti_1) {
            _fx_free_N14K_form__ktyp_t(&ti_1);
         }
         if (v_34) {
            _fx_free_N14K_form__ktyp_t(&v_34);
         }
         if (ti_0) {
            _fx_free_N14K_form__ktyp_t(&ti_0);
         }
         FX_CHECK_EXN(_fx_catch_12);
      }
      if (*final_mode_0) {
         _fx_R21K_form__kdefvariant_t* v_37 = &kvar_0->data;
         _fx_make_R21K_form__kdefvariant_t(&v_37->kvar_name, &v_37->kvar_cname, &v_37->kvar_proto, &v_37->kvar_props,
            v_37->kvar_targs, var_cases_0, v_37->kvar_ctors, &v_37->kvar_flags, v_37->kvar_ifaces, v_37->kvar_scope,
            &v_37->kvar_loc, &v_32);
         _fx_R21K_form__kdefvariant_t* v_38 = &kvar_0->data;
         _fx_free_R21K_form__kdefvariant_t(v_38);
         _fx_copy_R21K_form__kdefvariant_t(&v_32, v_38);
      }
      FX_COPY_PTR(e_0, fx_result);

   _fx_catch_12: ;
      _fx_free_R21K_form__kdefvariant_t(&v_32);
      if (var_cases_0) {
         _fx_free_LT2R9Ast__id_tN14K_form__ktyp_t(&var_cases_0);
      }
      FX_FREE_STR(&res_2);
      if (v_31) {
         _fx_free_N14K_form__ktyp_t(&v_31);
      }
      if (kvar_cases_0) {
         _fx_free_LT2R9Ast__id_tN14K_form__ktyp_t(&kvar_cases_0);
      }
      goto _fx_endmatch_1;
   }
   if (tag_0 == 35) {
      _fx_LT2R9Ast__id_tN14K_form__ktyp_t ki_all_methods_0 = 0;
      _fx_N14K_form__ktyp_t v_39 = 0;
      fx_str_t res_4 = {0};
      _fx_LT2R9Ast__id_tN14K_form__ktyp_t all_methods_0 = 0;
      _fx_R23K_form__kdefinterface_t v_40 = {0};
      _fx_rR23K_form__kdefinterface_t ki_0 = e_0->u.KDefInterface;
      _fx_R23K_form__kdefinterface_t* v_41 = &ki_0->data;
      _fx_R10Ast__loc_t ki_loc_0 = v_41->ki_loc;
      FX_COPY_PTR(v_41->ki_all_methods, &ki_all_methods_0);
      _fx_R9Ast__id_t ki_name_0 = v_41->ki_name;
      FX_CALL(_fx_M6K_formFM8KTypNameN14K_form__ktyp_t1R9Ast__id_t(&ki_name_0, &v_39), _fx_catch_16);
      FX_CALL(
         _fx_M8K_mangleFM11mangle_ktypS3N14K_form__ktyp_tNt10Hashmap__t2SR9Ast__id_tR10Ast__loc_t(v_39, mangle_map_0, &ki_loc_0,
            &res_4, 0), _fx_catch_16);
      _fx_LT2R9Ast__id_tN14K_form__ktyp_t lstend_3 = 0;
      _fx_LT2R9Ast__id_tN14K_form__ktyp_t lst_4 = ki_all_methods_0;
      for (; lst_4; lst_4 = lst_4->tl) {
         _fx_N14K_form__ktyp_t ti_2 = 0;
         _fx_N14K_form__ktyp_t v_42 = 0;
         _fx_T2LN14K_form__ktyp_tN14K_form__ktyp_t v_43 = {0};
         _fx_LN14K_form__ktyp_t args_0 = 0;
         _fx_N14K_form__ktyp_t rt_1 = 0;
         _fx_LN14K_form__ktyp_t args_1 = 0;
         _fx_N14K_form__ktyp_t rt_2 = 0;
         _fx_N14K_form__ktyp_t v_44 = 0;
         _fx_T2R9Ast__id_tN14K_form__ktyp_t tup_2 = {0};
         _fx_T2R9Ast__id_tN14K_form__ktyp_t* __pat___3 = &lst_4->hd;
         _fx_R9Ast__id_t fi_0 = __pat___3->t0;
         FX_COPY_PTR(__pat___3->t1, &ti_2);
         FX_CALL(_fx_M6K_formFM10deref_ktypN14K_form__ktyp_t2N14K_form__ktyp_tR10Ast__loc_t(ti_2, &ki_loc_0, &v_42, 0),
            _fx_catch_15);
         if (FX_REC_VARIANT_TAG(v_42) == 13) {
            _fx_T2LN14K_form__ktyp_tN14K_form__ktyp_t* vcase_2 = &v_42->u.KTypFun;
            _fx_make_T2LN14K_form__ktyp_tN14K_form__ktyp_t(vcase_2->t0, vcase_2->t1, &v_43);
         }
         else {
            fx_str_t v_45 = {0};
            fx_str_t v_46 = {0};
            fx_str_t v_47 = {0};
            fx_str_t v_48 = {0};
            fx_str_t v_49 = {0};
            fx_exn_t v_50 = {0};
            FX_CALL(_fx_M6K_formFM7idk2strS2R9Ast__id_tR10Ast__loc_t(&ki_name_0, &ki_loc_0, &v_45, 0), _fx_catch_13);
            FX_CALL(_fx_M8K_mangleFM6stringS1S(&v_45, &v_46, 0), _fx_catch_13);
            FX_CALL(_fx_M3AstFM2ppS1RM4id_t(&fi_0, &v_47, 0), _fx_catch_13);
            FX_CALL(_fx_M8K_mangleFM6stringS1S(&v_47, &v_48, 0), _fx_catch_13);
            fx_str_t slit_8 = FX_MAKE_STR("method \'");
            fx_str_t slit_9 = FX_MAKE_STR(".");
            fx_str_t slit_10 = FX_MAKE_STR("\' has non-function type");
            {
               const fx_str_t strs_4[] = { slit_8, v_46, slit_9, v_48, slit_10 };
               FX_CALL(fx_strjoin(0, 0, 0, strs_4, 5, &v_49), _fx_catch_13);
            }
            FX_CALL(_fx_M3AstFM11compile_errE2RM5loc_tS(&ki_loc_0, &v_49, &v_50, 0), _fx_catch_13);
            FX_THROW(&v_50, false, _fx_catch_13);

         _fx_catch_13: ;
            fx_free_exn(&v_50);
            FX_FREE_STR(&v_49);
            FX_FREE_STR(&v_48);
            FX_FREE_STR(&v_47);
            FX_FREE_STR(&v_46);
            FX_FREE_STR(&v_45);
         }
         FX_CHECK_EXN(_fx_catch_15);
         FX_COPY_PTR(v_43.t0, &args_0);
         FX_COPY_PTR(v_43.t1, &rt_1);
         _fx_LN14K_form__ktyp_t lstend_4 = 0;
         _fx_LN14K_form__ktyp_t lst_5 = args_0;
         for (; lst_5; lst_5 = lst_5->tl) {
            _fx_N14K_form__ktyp_t res_5 = 0;
            _fx_N14K_form__ktyp_t a_1 = lst_5->hd;
            FX_CALL(walk_ktyp_n_mangle_0.fp(a_1, &ki_loc_0, callb_0, &res_5, walk_ktyp_n_mangle_0.fcv), _fx_catch_14);
            _fx_LN14K_form__ktyp_t node_3 = 0;
            FX_CALL(_fx_cons_LN14K_form__ktyp_t(res_5, 0, false, &node_3), _fx_catch_14);
            FX_LIST_APPEND(args_1, lstend_4, node_3);

         _fx_catch_14: ;
            if (res_5) {
               _fx_free_N14K_form__ktyp_t(&res_5);
            }
            FX_CHECK_EXN(_fx_catch_15);
         }
         FX_CALL(walk_ktyp_n_mangle_0.fp(rt_1, &ki_loc_0, callb_0, &rt_2, walk_ktyp_n_mangle_0.fcv), _fx_catch_15);
         FX_CALL(_fx_M6K_formFM7KTypFunN14K_form__ktyp_t2LN14K_form__ktyp_tN14K_form__ktyp_t(args_1, rt_2, &v_44),
            _fx_catch_15);
         _fx_make_T2R9Ast__id_tN14K_form__ktyp_t(&fi_0, v_44, &tup_2);
         _fx_LT2R9Ast__id_tN14K_form__ktyp_t node_4 = 0;
         FX_CALL(_fx_cons_LT2R9Ast__id_tN14K_form__ktyp_t(&tup_2, 0, false, &node_4), _fx_catch_15);
         FX_LIST_APPEND(all_methods_0, lstend_3, node_4);

      _fx_catch_15: ;
         _fx_free_T2R9Ast__id_tN14K_form__ktyp_t(&tup_2);
         if (v_44) {
            _fx_free_N14K_form__ktyp_t(&v_44);
         }
         if (rt_2) {
            _fx_free_N14K_form__ktyp_t(&rt_2);
         }
         if (args_1) {
            _fx_free_LN14K_form__ktyp_t(&args_1);
         }
         if (rt_1) {
            _fx_free_N14K_form__ktyp_t(&rt_1);
         }
         if (args_0) {
            _fx_free_LN14K_form__ktyp_t(&args_0);
         }
         _fx_free_T2LN14K_form__ktyp_tN14K_form__ktyp_t(&v_43);
         if (v_42) {
            _fx_free_N14K_form__ktyp_t(&v_42);
         }
         if (ti_2) {
            _fx_free_N14K_form__ktyp_t(&ti_2);
         }
         FX_CHECK_EXN(_fx_catch_16);
      }
      if (*final_mode_0) {
         _fx_R23K_form__kdefinterface_t* v_51 = &ki_0->data;
         _fx_make_R23K_form__kdefinterface_t(&v_51->ki_name, &v_51->ki_base, &v_51->ki_cname, &v_51->ki_id, all_methods_0,
            v_51->ki_scope, &v_51->ki_loc, &v_40);
         _fx_R23K_form__kdefinterface_t* v_52 = &ki_0->data;
         _fx_free_R23K_form__kdefinterface_t(v_52);
         _fx_copy_R23K_form__kdefinterface_t(&v_40, v_52);
      }
      FX_COPY_PTR(e_0, fx_result);

   _fx_catch_16: ;
      _fx_free_R23K_form__kdefinterface_t(&v_40);
      if (all_methods_0) {
         _fx_free_LT2R9Ast__id_tN14K_form__ktyp_t(&all_methods_0);
      }
      FX_FREE_STR(&res_4);
      if (v_39) {
         _fx_free_N14K_form__ktyp_t(&v_39);
      }
      if (ki_all_methods_0) {
         _fx_free_LT2R9Ast__id_tN14K_form__ktyp_t(&ki_all_methods_0);
      }
      goto _fx_endmatch_1;
   }
   if (tag_0 == 36) {
      _fx_rR17K_form__kdeftyp_t kt_0 = e_0->u.KDefTyp;
      _fx_copy_R17K_form__kdeftyp_t(&kt_0->data, &v_0);
      if (FX_REC_VARIANT_TAG(v_0.kt_typ) == 15) {
         _fx_N14K_form__ktyp_t kt_typ_0 = 0;
         _fx_N14K_form__ktyp_t v_53 = 0;
         fx_str_t res_6 = {0};
         _fx_N14K_form__ktyp_t v_54 = 0;
         _fx_N14K_form__ktyp_t ktyp_1 = 0;
         _fx_R17K_form__kdeftyp_t v_55 = {0};
         _fx_R17K_form__kdeftyp_t* v_56 = &kt_0->data;
         _fx_R10Ast__loc_t kt_loc_0 = v_56->kt_loc;
         FX_COPY_PTR(v_56->kt_typ, &kt_typ_0);
         _fx_R9Ast__id_t kt_name_0 = v_56->kt_name;
         FX_CALL(_fx_M6K_formFM8KTypNameN14K_form__ktyp_t1R9Ast__id_t(&kt_name_0, &v_53), _fx_catch_18);
         FX_CALL(
            _fx_M8K_mangleFM11mangle_ktypS3N14K_form__ktyp_tNt10Hashmap__t2SR9Ast__id_tR10Ast__loc_t(v_53, mangle_map_0,
               &kt_loc_0, &res_6, 0), _fx_catch_18);
         FX_CALL(
            mangle_ktyp_retain_record_0.fp(kt_typ_0, &kt_loc_0, callb_0, curr_km_idx_ref_0, curr_top_code_ref_0, *final_mode_0,
               mangle_map_0, &v_54, mangle_ktyp_retain_record_0.fcv), _fx_catch_18);
         if (FX_REC_VARIANT_TAG(v_54) == 15) {
            FX_COPY_PTR(v_54, &ktyp_1);
         }
         else {
            fx_exn_t v_57 = {0};
            fx_str_t slit_11 = FX_MAKE_STR("after mangling record is not a record anymore");
            FX_CALL(_fx_M3AstFM11compile_errE2RM5loc_tS(&kt_loc_0, &slit_11, &v_57, 0), _fx_catch_17);
            FX_THROW(&v_57, false, _fx_catch_17);

         _fx_catch_17: ;
            fx_free_exn(&v_57);
         }
         FX_CHECK_EXN(_fx_catch_18);
         if (*final_mode_0) {
            _fx_R17K_form__kdeftyp_t* v_58 = &kt_0->data;
            _fx_make_R17K_form__kdeftyp_t(&v_58->kt_name, &v_58->kt_cname, &v_58->kt_proto, &v_58->kt_props, v_58->kt_targs,
               ktyp_1, v_58->kt_scope, &v_58->kt_loc, &v_55);
            _fx_R17K_form__kdeftyp_t* v_59 = &kt_0->data;
            _fx_free_R17K_form__kdeftyp_t(v_59);
            _fx_copy_R17K_form__kdeftyp_t(&v_55, v_59);
         }
         FX_COPY_PTR(e_0, fx_result);

      _fx_catch_18: ;
         _fx_free_R17K_form__kdeftyp_t(&v_55);
         if (ktyp_1) {
            _fx_free_N14K_form__ktyp_t(&ktyp_1);
         }
         if (v_54) {
            _fx_free_N14K_form__ktyp_t(&v_54);
         }
         FX_FREE_STR(&res_6);
         if (v_53) {
            _fx_free_N14K_form__ktyp_t(&v_53);
         }
         if (kt_typ_0) {
            _fx_free_N14K_form__ktyp_t(&kt_typ_0);
         }
         goto _fx_endmatch_1;
      }
   }
   if (tag_0 == 36) {
      FX_COPY_PTR(e_0, fx_result); goto _fx_endmatch_1;
   }
   if (tag_0 == 37) {
      FX_COPY_PTR(e_0, fx_result); goto _fx_endmatch_1;
   }
   if (tag_0 == 27) {
      _fx_T5LT2R9Ast__id_tN13K_form__dom_tLR9Ast__id_tN14K_form__kexp_tR16Ast__for_flags_tR10Ast__loc_t* vcase_3 =
         &e_0->u.KExpFor;
      FX_CALL(
         mangle_idoml_0.fp(vcase_3->t0, vcase_3->t1, &vcase_3->t4, callb_0, curr_km_idx_ref_0, curr_top_code_ref_0,
            *final_mode_0, mangle_map_0, mangle_idoml_0.fcv), _fx_catch_19);
      FX_CALL(_fx_M6K_formFM9walk_kexpN14K_form__kexp_t2N14K_form__kexp_tRM9k_callb_t(e_0, callb_0, fx_result, 0),
         _fx_catch_19);

   _fx_catch_19: ;
      goto _fx_endmatch_1;
   }
   if (tag_0 == 26) {
      _fx_LT3N14K_form__kexp_tLT2R9Ast__id_tN13K_form__dom_tLR9Ast__id_t e_idoml_l_0 = 0;
      _fx_T4LT3N14K_form__kexp_tLT2R9Ast__id_tN13K_form__dom_tLR9Ast__id_tN14K_form__kexp_tR16Ast__for_flags_tT2N14K_form__ktyp_tR10Ast__loc_t*
         vcase_4 = &e_0->u.KExpMap;
      FX_COPY_PTR(vcase_4->t0, &e_idoml_l_0);
      _fx_LT3N14K_form__kexp_tLT2R9Ast__id_tN13K_form__dom_tLR9Ast__id_t lst_6 = e_idoml_l_0;
      for (; lst_6; lst_6 = lst_6->tl) {
         _fx_LT2R9Ast__id_tN13K_form__dom_t idoml_0 = 0;
         _fx_LR9Ast__id_t idx_0 = 0;
         _fx_T3N14K_form__kexp_tLT2R9Ast__id_tN13K_form__dom_tLR9Ast__id_t* __pat___4 = &lst_6->hd;
         FX_COPY_PTR(__pat___4->t1, &idoml_0);
         FX_COPY_PTR(__pat___4->t2, &idx_0);
         FX_CALL(
            mangle_idoml_0.fp(idoml_0, idx_0, &vcase_4->t3.t1, callb_0, curr_km_idx_ref_0, curr_top_code_ref_0, *final_mode_0,
               mangle_map_0, mangle_idoml_0.fcv), _fx_catch_20);

      _fx_catch_20: ;
         FX_FREE_LIST_SIMPLE(&idx_0);
         if (idoml_0) {
            _fx_free_LT2R9Ast__id_tN13K_form__dom_t(&idoml_0);
         }
         FX_CHECK_EXN(_fx_catch_21);
      }
      FX_CALL(_fx_M6K_formFM9walk_kexpN14K_form__kexp_t2N14K_form__kexp_tRM9k_callb_t(e_0, callb_0, fx_result, 0),
         _fx_catch_21);

   _fx_catch_21: ;
      if (e_idoml_l_0) {
         _fx_free_LT3N14K_form__kexp_tLT2R9Ast__id_tN13K_form__dom_tLR9Ast__id_t(&e_idoml_l_0);
      }
      goto _fx_endmatch_1;
   }
   FX_CALL(_fx_M6K_formFM9walk_kexpN14K_form__kexp_t2N14K_form__kexp_tRM9k_callb_t(e_0, callb_0, fx_result, 0), _fx_catch_22);

_fx_catch_22: ;

_fx_endmatch_1: ;

_fx_cleanup: ;
   FX_FREE_FP(&mangle_id_typ_0);
   FX_FREE_FP(&walk_ktyp_n_mangle_0);
   FX_FREE_FP(&mangle_ktyp_retain_record_0);
   FX_FREE_FP(&mangle_idoml_0);
   _fx_free_R17K_form__kdeftyp_t(&v_0);
   return fx_status;
}

FX_EXTERN_C int
   _fx_M8K_mangleFM7make_fpFPN14K_form__kexp_t2N14K_form__kexp_tR17K_form__k_callb_t4rirLN14K_form__kexp_tBNt10Hashmap__t2SR9Ast__id_t(
   struct _fx_ri_data_t* arg0,
   struct _fx_rLN14K_form__kexp_t_data_t* arg1,
   bool arg2,
   struct _fx_Nt10Hashmap__t2SR9Ast__id_t_data_t* arg3,
   struct _fx_FPN14K_form__kexp_t2N14K_form__kexp_tR17K_form__k_callb_t* fx_result)
{
   FX_MAKE_FP_IMPL_START(_fx_M8K_mangleFM18walk_kexp_n_mangleN14K_form__kexp_t2N14K_form__kexp_tR17K_form__k_callb_t_cldata_t,
      _fx_free_M8K_mangleFM18walk_kexp_n_mangleN14K_form__kexp_t2N14K_form__kexp_tR17K_form__k_callb_t,
      _fx_M8K_mangleFM18walk_kexp_n_mangleN14K_form__kexp_t2N14K_form__kexp_tR17K_form__k_callb_t);
   FX_COPY_PTR(arg0, &fcv->t0);
   FX_COPY_PTR(arg1, &fcv->t1);
   fcv->t2 = arg2;
   FX_COPY_PTR(arg3, &fcv->t3);
   return 0;
}

FX_EXTERN_C int _fx_M8K_mangleFM20fold_ktyp_n_demanglev3N14K_form__ktyp_tR10Ast__loc_tR22K_form__k_fold_callb_t(
   struct _fx_N14K_form__ktyp_t_data_t* t_0,
   struct _fx_R10Ast__loc_t* loc_0,
   struct _fx_R22K_form__k_fold_callb_t* callb_0,
   void* fx_fv)
{
   int fx_status = 0;
   return fx_status;
}

FX_EXTERN_C int _fx_M8K_mangleFM20fold_kexp_n_demanglev2N14K_form__kexp_tR22K_form__k_fold_callb_t(
   struct _fx_N14K_form__kexp_t_data_t* e_0,
   struct _fx_R22K_form__k_fold_callb_t* callb_0,
   void* fx_fv)
{
   _fx_N14K_form__kexp_t e_1 = 0;
   _fx_R22K_form__k_fold_callb_t callb_1 = {0};
   int fx_status = 0;
   FX_CALL(fx_check_stack(), _fx_cleanup);
   FX_COPY_PTR(e_0, &e_1);
   _fx_copy_R22K_form__k_fold_callb_t(callb_0, &callb_1);
   for (;;) {
      _fx_N14K_form__kexp_t e_2 = 0;
      _fx_R22K_form__k_fold_callb_t callb_2 = {0};
      FX_COPY_PTR(e_1, &e_2);
      _fx_copy_R22K_form__k_fold_callb_t(&callb_1, &callb_2);
      int tag_0 = FX_REC_VARIANT_TAG(e_2);
      if (tag_0 == 31) {
         _fx_R17K_form__kdefval_t kv_0 = {0};
         _fx_R17K_form__kdefval_t v_0 = {0};
         _fx_N15K_form__kinfo_t v_1 = {0};
         _fx_T3R9Ast__id_tN14K_form__kexp_tR10Ast__loc_t* vcase_0 = &e_2->u.KDefVal;
         _fx_R9Ast__id_t* n_0 = &vcase_0->t0;
         FX_CALL(_fx_M6K_formFM8get_kvalRM9kdefval_t2R9Ast__id_tR10Ast__loc_t(n_0, &vcase_0->t2, &kv_0, 0), _fx_catch_0);
         fx_str_t slit_0 = FX_MAKE_STR("");
         _fx_make_R17K_form__kdefval_t(&kv_0.kv_name, &slit_0, kv_0.kv_typ, &kv_0.kv_flags, &kv_0.kv_loc, &v_0);
         _fx_M6K_formFM4KValN15K_form__kinfo_t1RM9kdefval_t(&v_0, &v_1);
         FX_CALL(_fx_M6K_formFM13set_idk_entryv2R9Ast__id_tN15K_form__kinfo_t(n_0, &v_1, 0), _fx_catch_0);
         _fx_N14K_form__kexp_t* e_3 = &vcase_0->t1;
         _fx_free_N14K_form__kexp_t(&e_1);
         FX_COPY_PTR(*e_3, &e_1);
         _fx_free_R22K_form__k_fold_callb_t(&callb_1);
         _fx_copy_R22K_form__k_fold_callb_t(&callb_2, &callb_1);

      _fx_catch_0: ;
         _fx_free_N15K_form__kinfo_t(&v_1);
         _fx_free_R17K_form__kdefval_t(&v_0);
         _fx_free_R17K_form__kdefval_t(&kv_0);
      }
      else if (tag_0 == 32) {
         _fx_N14K_form__kexp_t kf_body_0 = 0;
         _fx_LR9Ast__id_t kf_params_0 = 0;
         _fx_R17K_form__kdeffun_t v_2 = {0};
         _fx_rR17K_form__kdeffun_t kf_0 = e_2->u.KDefFun;
         _fx_R17K_form__kdeffun_t* v_3 = &kf_0->data;
         _fx_R10Ast__loc_t kf_loc_0 = v_3->kf_loc;
         FX_COPY_PTR(v_3->kf_body, &kf_body_0);
         FX_COPY_PTR(v_3->kf_params, &kf_params_0);
         _fx_LR9Ast__id_t lst_0 = kf_params_0;
         for (; lst_0; lst_0 = lst_0->tl) {
            _fx_R17K_form__kdefval_t kv_1 = {0};
            _fx_R17K_form__kdefval_t v_4 = {0};
            _fx_N15K_form__kinfo_t v_5 = {0};
            _fx_R9Ast__id_t* x_0 = &lst_0->hd;
            FX_CALL(_fx_M6K_formFM8get_kvalRM9kdefval_t2R9Ast__id_tR10Ast__loc_t(x_0, &kf_loc_0, &kv_1, 0), _fx_catch_1);
            fx_str_t slit_1 = FX_MAKE_STR("");
            _fx_make_R17K_form__kdefval_t(&kv_1.kv_name, &slit_1, kv_1.kv_typ, &kv_1.kv_flags, &kv_1.kv_loc, &v_4);
            _fx_M6K_formFM4KValN15K_form__kinfo_t1RM9kdefval_t(&v_4, &v_5);
            FX_CALL(_fx_M6K_formFM13set_idk_entryv2R9Ast__id_tN15K_form__kinfo_t(x_0, &v_5, 0), _fx_catch_1);

         _fx_catch_1: ;
            _fx_free_N15K_form__kinfo_t(&v_5);
            _fx_free_R17K_form__kdefval_t(&v_4);
            _fx_free_R17K_form__kdefval_t(&kv_1);
            FX_CHECK_EXN(_fx_catch_2);
         }
         FX_CALL(_fx_M8K_mangleFM20fold_kexp_n_demanglev2N14K_form__kexp_tR22K_form__k_fold_callb_t(kf_body_0, &callb_2, 0),
            _fx_catch_2);
         _fx_R17K_form__kdeffun_t* v_6 = &kf_0->data;
         fx_str_t slit_2 = FX_MAKE_STR("");
         _fx_make_R17K_form__kdeffun_t(&v_6->kf_name, &slit_2, v_6->kf_params, v_6->kf_rt, v_6->kf_body, &v_6->kf_flags,
            &v_6->kf_closure, v_6->kf_scope, &v_6->kf_loc, &v_2);
         _fx_R17K_form__kdeffun_t* v_7 = &kf_0->data;
         _fx_free_R17K_form__kdeffun_t(v_7);
         _fx_copy_R17K_form__kdeffun_t(&v_2, v_7);
         FX_BREAK(_fx_catch_2);

      _fx_catch_2: ;
         _fx_free_R17K_form__kdeffun_t(&v_2);
         FX_FREE_LIST_SIMPLE(&kf_params_0);
         if (kf_body_0) {
            _fx_free_N14K_form__kexp_t(&kf_body_0);
         }
      }
      else if (tag_0 == 33) {
         _fx_R17K_form__kdefexn_t v_8 = {0};
         _fx_R17K_form__kdefval_t tag_kv_0 = {0};
         _fx_R17K_form__kdefval_t v_9 = {0};
         _fx_N15K_form__kinfo_t v_10 = {0};
         _fx_rR17K_form__kdefexn_t ke_0 = e_2->u.KDefExn;
         _fx_R17K_form__kdefexn_t* v_11 = &ke_0->data;
         _fx_R9Ast__id_t ke_tag_0 = v_11->ke_tag;
         _fx_R10Ast__loc_t ke_loc_0 = v_11->ke_loc;
         _fx_R17K_form__kdefexn_t* v_12 = &ke_0->data;
         fx_str_t slit_3 = FX_MAKE_STR("");
         fx_str_t slit_4 = FX_MAKE_STR("");
         _fx_make_R17K_form__kdefexn_t(&v_12->ke_name, &slit_3, &slit_4, v_12->ke_typ, v_12->ke_std, &v_12->ke_tag,
            &v_12->ke_make, v_12->ke_scope, &v_12->ke_loc, &v_8);
         _fx_R17K_form__kdefexn_t* v_13 = &ke_0->data;
         _fx_free_R17K_form__kdefexn_t(v_13);
         _fx_copy_R17K_form__kdefexn_t(&v_8, v_13);
         FX_CALL(_fx_M6K_formFM8get_kvalRM9kdefval_t2R9Ast__id_tR10Ast__loc_t(&ke_tag_0, &ke_loc_0, &tag_kv_0, 0), _fx_catch_3);
         fx_str_t slit_5 = FX_MAKE_STR("");
         _fx_make_R17K_form__kdefval_t(&tag_kv_0.kv_name, &slit_5, tag_kv_0.kv_typ, &tag_kv_0.kv_flags, &tag_kv_0.kv_loc, &v_9);
         _fx_M6K_formFM4KValN15K_form__kinfo_t1RM9kdefval_t(&v_9, &v_10);
         FX_CALL(_fx_M6K_formFM13set_idk_entryv2R9Ast__id_tN15K_form__kinfo_t(&ke_tag_0, &v_10, 0), _fx_catch_3);
         FX_BREAK(_fx_catch_3);

      _fx_catch_3: ;
         _fx_free_N15K_form__kinfo_t(&v_10);
         _fx_free_R17K_form__kdefval_t(&v_9);
         _fx_free_R17K_form__kdefval_t(&tag_kv_0);
         _fx_free_R17K_form__kdefexn_t(&v_8);
      }
      else if (tag_0 == 34) {
         _fx_N15K_form__kinfo_t v_14 = {0};
         _fx_R21K_form__kdefvariant_t v_15 = {0};
         _fx_rR21K_form__kdefvariant_t kvar_0 = e_2->u.KDefVariant;
         _fx_R21K_form__kdefvariant_t* v_16 = &kvar_0->data;
         _fx_R10Ast__loc_t kvar_loc_0 = v_16->kvar_loc;
         _fx_R9Ast__id_t kvar_proto_0 = v_16->kvar_proto;
         bool res_0;
         FX_CALL(_fx_M3AstFM6__eq__B2RM4id_tRM4id_t(&kvar_proto_0, &_fx_g9Ast__noid, &res_0, 0), _fx_catch_4);
         if (!res_0) {
            FX_CALL(_fx_M6K_formFM6kinfo_N15K_form__kinfo_t2R9Ast__id_tR10Ast__loc_t(&kvar_proto_0, &kvar_loc_0, &v_14, 0),
               _fx_catch_4);
         }
         else {
            _fx_copy_N15K_form__kinfo_t(&_fx_g15K_mangle__KNone, &v_14);
         }
         if (v_14.tag == 5) {
            _fx_R21K_form__kdefvariant_t v_17 = {0};
            _fx_rR21K_form__kdefvariant_t kvar2_0 = v_14.u.KVariant;
            _fx_R21K_form__kdefvariant_t* v_18 = &kvar2_0->data;
            fx_str_t slit_6 = FX_MAKE_STR("");
            _fx_make_R21K_form__kdefvariant_t(&v_18->kvar_name, &slit_6, &v_18->kvar_proto, &v_18->kvar_props, v_18->kvar_targs,
               v_18->kvar_cases, v_18->kvar_ctors, &v_18->kvar_flags, v_18->kvar_ifaces, v_18->kvar_scope, &v_18->kvar_loc,
               &v_17);
            _fx_R21K_form__kdefvariant_t* v_19 = &kvar2_0->data;
            _fx_free_R21K_form__kdefvariant_t(v_19);
            _fx_copy_R21K_form__kdefvariant_t(&v_17, v_19);
            _fx_free_R21K_form__kdefvariant_t(&v_17);
         }
         FX_CHECK_EXN(_fx_catch_4);
         _fx_R21K_form__kdefvariant_t* v_20 = &kvar_0->data;
         fx_str_t slit_7 = FX_MAKE_STR("");
         _fx_make_R21K_form__kdefvariant_t(&v_20->kvar_name, &slit_7, &v_20->kvar_proto, &v_20->kvar_props, v_20->kvar_targs,
            v_20->kvar_cases, v_20->kvar_ctors, &v_20->kvar_flags, v_20->kvar_ifaces, v_20->kvar_scope, &v_20->kvar_loc, &v_15);
         _fx_R21K_form__kdefvariant_t* v_21 = &kvar_0->data;
         _fx_free_R21K_form__kdefvariant_t(v_21);
         _fx_copy_R21K_form__kdefvariant_t(&v_15, v_21);
         FX_BREAK(_fx_catch_4);

      _fx_catch_4: ;
         _fx_free_R21K_form__kdefvariant_t(&v_15);
         _fx_free_N15K_form__kinfo_t(&v_14);
      }
      else if (tag_0 == 35) {
         _fx_R23K_form__kdefinterface_t v_22 = {0};
         _fx_rR23K_form__kdefinterface_t ki_0 = e_2->u.KDefInterface;
         _fx_R23K_form__kdefinterface_t* v_23 = &ki_0->data;
         fx_str_t slit_8 = FX_MAKE_STR("");
         _fx_make_R23K_form__kdefinterface_t(&v_23->ki_name, &v_23->ki_base, &slit_8, &v_23->ki_id, v_23->ki_all_methods,
            v_23->ki_scope, &v_23->ki_loc, &v_22);
         _fx_R23K_form__kdefinterface_t* v_24 = &ki_0->data;
         _fx_free_R23K_form__kdefinterface_t(v_24);
         _fx_copy_R23K_form__kdefinterface_t(&v_22, v_24);
         FX_BREAK(_fx_catch_5);

      _fx_catch_5: ;
         _fx_free_R23K_form__kdefinterface_t(&v_22);
      }
      else if (tag_0 == 36) {
         _fx_N15K_form__kinfo_t v_25 = {0};
         _fx_R17K_form__kdeftyp_t v_26 = {0};
         _fx_rR17K_form__kdeftyp_t kt_0 = e_2->u.KDefTyp;
         _fx_R17K_form__kdeftyp_t* v_27 = &kt_0->data;
         _fx_R10Ast__loc_t kt_loc_0 = v_27->kt_loc;
         _fx_R9Ast__id_t kt_proto_0 = v_27->kt_proto;
         bool res_1;
         FX_CALL(_fx_M3AstFM6__eq__B2RM4id_tRM4id_t(&kt_proto_0, &_fx_g9Ast__noid, &res_1, 0), _fx_catch_6);
         if (!res_1) {
            FX_CALL(_fx_M6K_formFM6kinfo_N15K_form__kinfo_t2R9Ast__id_tR10Ast__loc_t(&kt_proto_0, &kt_loc_0, &v_25, 0),
               _fx_catch_6);
         }
         else {
            _fx_copy_N15K_form__kinfo_t(&_fx_g15K_mangle__KNone, &v_25);
         }
         if (v_25.tag == 8) {
            _fx_R17K_form__kdeftyp_t v_28 = {0};
            _fx_rR17K_form__kdeftyp_t kt2_0 = v_25.u.KTyp;
            _fx_R17K_form__kdeftyp_t* v_29 = &kt2_0->data;
            fx_str_t slit_9 = FX_MAKE_STR("");
            _fx_make_R17K_form__kdeftyp_t(&v_29->kt_name, &slit_9, &v_29->kt_proto, &v_29->kt_props, v_29->kt_targs,
               v_29->kt_typ, v_29->kt_scope, &v_29->kt_loc, &v_28);
            _fx_R17K_form__kdeftyp_t* v_30 = &kt2_0->data;
            _fx_free_R17K_form__kdeftyp_t(v_30);
            _fx_copy_R17K_form__kdeftyp_t(&v_28, v_30);
            _fx_free_R17K_form__kdeftyp_t(&v_28);
         }
         FX_CHECK_EXN(_fx_catch_6);
         _fx_R17K_form__kdeftyp_t* v_31 = &kt_0->data;
         fx_str_t slit_10 = FX_MAKE_STR("");
         _fx_make_R17K_form__kdeftyp_t(&v_31->kt_name, &slit_10, &v_31->kt_proto, &v_31->kt_props, v_31->kt_targs, v_31->kt_typ,
            v_31->kt_scope, &v_31->kt_loc, &v_26);
         _fx_R17K_form__kdeftyp_t* v_32 = &kt_0->data;
         _fx_free_R17K_form__kdeftyp_t(v_32);
         _fx_copy_R17K_form__kdeftyp_t(&v_26, v_32);
         FX_BREAK(_fx_catch_6);

      _fx_catch_6: ;
         _fx_free_R17K_form__kdeftyp_t(&v_26);
         _fx_free_N15K_form__kinfo_t(&v_25);
      }
      else if (tag_0 == 26) {
         _fx_LT3N14K_form__kexp_tLT2R9Ast__id_tN13K_form__dom_tLR9Ast__id_t clauses_0 = 0;
         _fx_T4LT3N14K_form__kexp_tLT2R9Ast__id_tN13K_form__dom_tLR9Ast__id_tN14K_form__kexp_tR16Ast__for_flags_tT2N14K_form__ktyp_tR10Ast__loc_t*
            vcase_1 = &e_2->u.KExpMap;
         _fx_R10Ast__loc_t* loc_0 = &vcase_1->t3.t1;
         FX_CALL(_fx_M6K_formFM9fold_kexpv2N14K_form__kexp_tRM14k_fold_callb_t(e_2, &callb_2, 0), _fx_catch_10);
         FX_COPY_PTR(vcase_1->t0, &clauses_0);
         _fx_LT3N14K_form__kexp_tLT2R9Ast__id_tN13K_form__dom_tLR9Ast__id_t lst_1 = clauses_0;
         for (; lst_1; lst_1 = lst_1->tl) {
            _fx_LT2R9Ast__id_tN13K_form__dom_t id_l_0 = 0;
            _fx_LR9Ast__id_t at_ids_0 = 0;
            _fx_T3N14K_form__kexp_tLT2R9Ast__id_tN13K_form__dom_tLR9Ast__id_t* __pat___0 = &lst_1->hd;
            FX_COPY_PTR(__pat___0->t1, &id_l_0);
            FX_COPY_PTR(__pat___0->t2, &at_ids_0);
            _fx_LR9Ast__id_t lst_2 = at_ids_0;
            for (; lst_2; lst_2 = lst_2->tl) {
               _fx_R17K_form__kdefval_t kv_2 = {0};
               _fx_R17K_form__kdefval_t v_33 = {0};
               _fx_N15K_form__kinfo_t v_34 = {0};
               _fx_R9Ast__id_t* i_0 = &lst_2->hd;
               FX_CALL(_fx_M6K_formFM8get_kvalRM9kdefval_t2R9Ast__id_tR10Ast__loc_t(i_0, loc_0, &kv_2, 0), _fx_catch_7);
               fx_str_t slit_11 = FX_MAKE_STR("");
               _fx_make_R17K_form__kdefval_t(&kv_2.kv_name, &slit_11, kv_2.kv_typ, &kv_2.kv_flags, &kv_2.kv_loc, &v_33);
               _fx_M6K_formFM4KValN15K_form__kinfo_t1RM9kdefval_t(&v_33, &v_34);
               FX_CALL(_fx_M6K_formFM13set_idk_entryv2R9Ast__id_tN15K_form__kinfo_t(i_0, &v_34, 0), _fx_catch_7);

            _fx_catch_7: ;
               _fx_free_N15K_form__kinfo_t(&v_34);
               _fx_free_R17K_form__kdefval_t(&v_33);
               _fx_free_R17K_form__kdefval_t(&kv_2);
               FX_CHECK_EXN(_fx_catch_9);
            }
            _fx_LT2R9Ast__id_tN13K_form__dom_t lst_3 = id_l_0;
            for (; lst_3; lst_3 = lst_3->tl) {
               _fx_R17K_form__kdefval_t kv_3 = {0};
               _fx_R17K_form__kdefval_t v_35 = {0};
               _fx_N15K_form__kinfo_t v_36 = {0};
               _fx_T2R9Ast__id_tN13K_form__dom_t* __pat___1 = &lst_3->hd;
               _fx_R9Ast__id_t i_1 = __pat___1->t0;
               FX_CALL(_fx_M6K_formFM8get_kvalRM9kdefval_t2R9Ast__id_tR10Ast__loc_t(&i_1, loc_0, &kv_3, 0), _fx_catch_8);
               fx_str_t slit_12 = FX_MAKE_STR("");
               _fx_make_R17K_form__kdefval_t(&kv_3.kv_name, &slit_12, kv_3.kv_typ, &kv_3.kv_flags, &kv_3.kv_loc, &v_35);
               _fx_M6K_formFM4KValN15K_form__kinfo_t1RM9kdefval_t(&v_35, &v_36);
               FX_CALL(_fx_M6K_formFM13set_idk_entryv2R9Ast__id_tN15K_form__kinfo_t(&i_1, &v_36, 0), _fx_catch_8);

            _fx_catch_8: ;
               _fx_free_N15K_form__kinfo_t(&v_36);
               _fx_free_R17K_form__kdefval_t(&v_35);
               _fx_free_R17K_form__kdefval_t(&kv_3);
               FX_CHECK_EXN(_fx_catch_9);
            }

         _fx_catch_9: ;
            FX_FREE_LIST_SIMPLE(&at_ids_0);
            if (id_l_0) {
               _fx_free_LT2R9Ast__id_tN13K_form__dom_t(&id_l_0);
            }
            FX_CHECK_EXN(_fx_catch_10);
         }
         FX_BREAK(_fx_catch_10);

      _fx_catch_10: ;
         if (clauses_0) {
            _fx_free_LT3N14K_form__kexp_tLT2R9Ast__id_tN13K_form__dom_tLR9Ast__id_t(&clauses_0);
         }
      }
      else if (tag_0 == 27) {
         _fx_LR9Ast__id_t at_ids_1 = 0;
         _fx_LT2R9Ast__id_tN13K_form__dom_t id_l_1 = 0;
         _fx_T5LT2R9Ast__id_tN13K_form__dom_tLR9Ast__id_tN14K_form__kexp_tR16Ast__for_flags_tR10Ast__loc_t* vcase_2 =
            &e_2->u.KExpFor;
         _fx_R10Ast__loc_t* loc_1 = &vcase_2->t4;
         FX_CALL(_fx_M6K_formFM9fold_kexpv2N14K_form__kexp_tRM14k_fold_callb_t(e_2, &callb_2, 0), _fx_catch_13);
         FX_COPY_PTR(vcase_2->t1, &at_ids_1);
         _fx_LR9Ast__id_t lst_4 = at_ids_1;
         for (; lst_4; lst_4 = lst_4->tl) {
            _fx_R17K_form__kdefval_t kv_4 = {0};
            _fx_R17K_form__kdefval_t v_37 = {0};
            _fx_N15K_form__kinfo_t v_38 = {0};
            _fx_R9Ast__id_t* i_2 = &lst_4->hd;
            FX_CALL(_fx_M6K_formFM8get_kvalRM9kdefval_t2R9Ast__id_tR10Ast__loc_t(i_2, loc_1, &kv_4, 0), _fx_catch_11);
            fx_str_t slit_13 = FX_MAKE_STR("");
            _fx_make_R17K_form__kdefval_t(&kv_4.kv_name, &slit_13, kv_4.kv_typ, &kv_4.kv_flags, &kv_4.kv_loc, &v_37);
            _fx_M6K_formFM4KValN15K_form__kinfo_t1RM9kdefval_t(&v_37, &v_38);
            FX_CALL(_fx_M6K_formFM13set_idk_entryv2R9Ast__id_tN15K_form__kinfo_t(i_2, &v_38, 0), _fx_catch_11);

         _fx_catch_11: ;
            _fx_free_N15K_form__kinfo_t(&v_38);
            _fx_free_R17K_form__kdefval_t(&v_37);
            _fx_free_R17K_form__kdefval_t(&kv_4);
            FX_CHECK_EXN(_fx_catch_13);
         }
         FX_COPY_PTR(vcase_2->t0, &id_l_1);
         _fx_LT2R9Ast__id_tN13K_form__dom_t lst_5 = id_l_1;
         for (; lst_5; lst_5 = lst_5->tl) {
            _fx_R17K_form__kdefval_t kv_5 = {0};
            _fx_R17K_form__kdefval_t v_39 = {0};
            _fx_N15K_form__kinfo_t v_40 = {0};
            _fx_T2R9Ast__id_tN13K_form__dom_t* __pat___2 = &lst_5->hd;
            _fx_R9Ast__id_t i_3 = __pat___2->t0;
            FX_CALL(_fx_M6K_formFM8get_kvalRM9kdefval_t2R9Ast__id_tR10Ast__loc_t(&i_3, loc_1, &kv_5, 0), _fx_catch_12);
            fx_str_t slit_14 = FX_MAKE_STR("");
            _fx_make_R17K_form__kdefval_t(&kv_5.kv_name, &slit_14, kv_5.kv_typ, &kv_5.kv_flags, &kv_5.kv_loc, &v_39);
            _fx_M6K_formFM4KValN15K_form__kinfo_t1RM9kdefval_t(&v_39, &v_40);
            FX_CALL(_fx_M6K_formFM13set_idk_entryv2R9Ast__id_tN15K_form__kinfo_t(&i_3, &v_40, 0), _fx_catch_12);

         _fx_catch_12: ;
            _fx_free_N15K_form__kinfo_t(&v_40);
            _fx_free_R17K_form__kdefval_t(&v_39);
            _fx_free_R17K_form__kdefval_t(&kv_5);
            FX_CHECK_EXN(_fx_catch_13);
         }
         FX_BREAK(_fx_catch_13);

      _fx_catch_13: ;
         if (id_l_1) {
            _fx_free_LT2R9Ast__id_tN13K_form__dom_t(&id_l_1);
         }
         FX_FREE_LIST_SIMPLE(&at_ids_1);
      }
      else {
         FX_CALL(_fx_M6K_formFM9fold_kexpv2N14K_form__kexp_tRM14k_fold_callb_t(e_2, &callb_2, 0), _fx_catch_14);
         FX_BREAK(_fx_catch_14);

      _fx_catch_14: ;
      }
      FX_CHECK_EXN(_fx_catch_15);

   _fx_catch_15: ;
      _fx_free_R22K_form__k_fold_callb_t(&callb_2);
      if (e_2) {
         _fx_free_N14K_form__kexp_t(&e_2);
      }
      FX_CHECK_BREAK();
      FX_CHECK_EXN(_fx_cleanup);
   }

_fx_cleanup: ;
   if (e_1) {
      _fx_free_N14K_form__kexp_t(&e_1);
   }
   _fx_free_R22K_form__k_fold_callb_t(&callb_1);
   return fx_status;
}

FX_EXTERN_C int _fx_M8K_mangleFM12demangle_allLR17K_form__kmodule_t1LR17K_form__kmodule_t(
   struct _fx_LR17K_form__kmodule_t_data_t* kmods_0,
   struct _fx_LR17K_form__kmodule_t_data_t** fx_result,
   void* fx_fv)
{
   _fx_FPv3N14K_form__ktyp_tR10Ast__loc_tR22K_form__k_fold_callb_t fold_ktyp_n_demangle_0 = {0};
   _fx_Nt6option1FPv3N14K_form__ktyp_tR10Ast__loc_tR22K_form__k_fold_callb_t v_0 = 0;
   _fx_FPv2N14K_form__kexp_tR22K_form__k_fold_callb_t fold_kexp_n_demangle_0 = {0};
   _fx_Nt6option1FPv2N14K_form__kexp_tR22K_form__k_fold_callb_t v_1 = 0;
   _fx_R22K_form__k_fold_callb_t fold_n_demangle_callb_0 = {0};
   int fx_status = 0;
   _fx_FPv3N14K_form__ktyp_tR10Ast__loc_tR22K_form__k_fold_callb_t fold_ktyp_n_demangle_fp_0 =
      { _fx_M8K_mangleFM20fold_ktyp_n_demanglev3N14K_form__ktyp_tR10Ast__loc_tR22K_form__k_fold_callb_t, 0 };
   FX_COPY_FP(&fold_ktyp_n_demangle_fp_0, &fold_ktyp_n_demangle_0);
   FX_CALL(
      _fx_M8K_mangleFM4SomeNt6option1FPv3N14K_form__ktyp_tR10Ast__loc_tR22K_form__k_fold_callb_t1FPv3N14K_form__ktyp_tR10Ast__loc_tR22K_form__k_fold_callb_t(
         &fold_ktyp_n_demangle_0, &v_0), _fx_cleanup);
   _fx_FPv2N14K_form__kexp_tR22K_form__k_fold_callb_t fold_kexp_n_demangle_fp_0 =
      { _fx_M8K_mangleFM20fold_kexp_n_demanglev2N14K_form__kexp_tR22K_form__k_fold_callb_t, 0 };
   FX_COPY_FP(&fold_kexp_n_demangle_fp_0, &fold_kexp_n_demangle_0);
   FX_CALL(
      _fx_M8K_mangleFM4SomeNt6option1FPv2N14K_form__kexp_tR22K_form__k_fold_callb_t1FPv2N14K_form__kexp_tR22K_form__k_fold_callb_t(
         &fold_kexp_n_demangle_0, &v_1), _fx_cleanup);
   _fx_make_R22K_form__k_fold_callb_t(v_0, v_1, _fx_g14K_mangle__None, &fold_n_demangle_callb_0);
   _fx_LR17K_form__kmodule_t lst_0 = kmods_0;
   for (; lst_0; lst_0 = lst_0->tl) {
      _fx_LN14K_form__kexp_t km_top_0 = 0;
      _fx_R17K_form__kmodule_t* km_0 = &lst_0->hd;
      FX_COPY_PTR(km_0->km_top, &km_top_0);
      _fx_LN14K_form__kexp_t lst_1 = km_top_0;
      for (; lst_1; lst_1 = lst_1->tl) {
         _fx_N14K_form__kexp_t e_0 = lst_1->hd;
         FX_CALL(
            _fx_M8K_mangleFM20fold_kexp_n_demanglev2N14K_form__kexp_tR22K_form__k_fold_callb_t(e_0, &fold_n_demangle_callb_0,
               0), _fx_catch_0);

      _fx_catch_0: ;
         FX_CHECK_EXN(_fx_catch_1);
      }

   _fx_catch_1: ;
      if (km_top_0) {
         _fx_free_LN14K_form__kexp_t(&km_top_0);
      }
      FX_CHECK_EXN(_fx_cleanup);
   }
   FX_COPY_PTR(kmods_0, fx_result);

_fx_cleanup: ;
   FX_FREE_FP(&fold_ktyp_n_demangle_0);
   if (v_0) {
      _fx_free_Nt6option1FPv3N14K_form__ktyp_tR10Ast__loc_tR22K_form__k_fold_callb_t(&v_0);
   }
   FX_FREE_FP(&fold_kexp_n_demangle_0);
   if (v_1) {
      _fx_free_Nt6option1FPv2N14K_form__kexp_tR22K_form__k_fold_callb_t(&v_1);
   }
   _fx_free_R22K_form__k_fold_callb_t(&fold_n_demangle_callb_0);
   return fx_status;
}

FX_EXTERN_C int _fx_M8K_mangleFM12mangle_ktyp_v3N14K_form__ktyp_tR10Ast__loc_tR22K_form__k_fold_callb_t(
   struct _fx_N14K_form__ktyp_t_data_t* t_0,
   struct _fx_R10Ast__loc_t* loc_0,
   struct _fx_R22K_form__k_fold_callb_t* callb_0,
   void* fx_fv)
{
   int fx_status = 0;
   return fx_status;
}

FX_EXTERN_C int _fx_M8K_mangleFM13mangle_localsLR17K_form__kmodule_t1LR17K_form__kmodule_t(
   struct _fx_LR17K_form__kmodule_t_data_t* kmods_0,
   struct _fx_LR17K_form__kmodule_t_data_t** fx_result,
   void* fx_fv)
{
   fx_arr_t v_0 = {0};
   fx_arr_t v_1 = {0};
   _fx_Nt10Hashmap__t2ii global_prefix_hash_arg_0 = 0;
   _fx_rNt10Hashmap__t2ii global_prefix_hash_ref_0 = 0;
   fx_arr_t v_2 = {0};
   fx_arr_t v_3 = {0};
   _fx_Nt10Hashmap__t2ii prefix_hash_arg_0 = 0;
   _fx_rNt10Hashmap__t2ii prefix_hash_ref_0 = 0;
   _fx_FPv2N14K_form__kexp_tR22K_form__k_fold_callb_t mangle_kexp__0 = {0};
   _fx_FPv3N14K_form__ktyp_tR10Ast__loc_tR22K_form__k_fold_callb_t mangle_ktyp__0 = {0};
   _fx_Nt6option1FPv3N14K_form__ktyp_tR10Ast__loc_tR22K_form__k_fold_callb_t v_4 = 0;
   _fx_Nt6option1FPv2N14K_form__kexp_tR22K_form__k_fold_callb_t v_5 = 0;
   _fx_R22K_form__k_fold_callb_t mangle_callb_0 = {0};
   int fx_status = 0;
   int_ size_0 = 8;
   while (size_0 < 256) {
      size_0 = size_0 * 2;
   }
   int_ idxsize_0 = size_0 * 2;
   _fx_Rt20Hashmap__hashentry_t2ii entry0_0 = { 0ULL, 0, -1 };
   FX_CALL(_fx_M7HashmapFM9makeindexA1i1i(idxsize_0, &v_0, 0), _fx_cleanup);
   _fx_Rt20Hashmap__hashentry_t2ii* dstptr_0 = 0;
   int_ n_0 = size_0;
   {
      const int_ shape_0[] = { n_0 };
      FX_CALL(fx_make_arr(1, shape_0, sizeof(_fx_Rt20Hashmap__hashentry_t2ii), 0, 0, 0, &v_1), _fx_cleanup);
   }
   dstptr_0 = (_fx_Rt20Hashmap__hashentry_t2ii*)v_1.data;
   for (int_ i_0 = 0; i_0 < n_0; i_0++, dstptr_0++) {
      *dstptr_0 = entry0_0;
   }
   FX_CALL(
      _fx_M8K_mangleFM1tNt10Hashmap__t2ii6Rt20Hashmap__hashentry_t2iiiiiA1iA1Rt20Hashmap__hashentry_t2ii(&entry0_0, 0, 0, 0,
         &v_0, &v_1, &global_prefix_hash_arg_0), _fx_cleanup);
   FX_CALL(_fx_make_rNt10Hashmap__t2ii(global_prefix_hash_arg_0, &global_prefix_hash_ref_0), _fx_cleanup);
   _fx_Nt10Hashmap__t2ii* global_prefix_hash_0 = &global_prefix_hash_ref_0->data;
   int_ size_1 = 8;
   while (size_1 < 256) {
      size_1 = size_1 * 2;
   }
   int_ idxsize_1 = size_1 * 2;
   _fx_Rt20Hashmap__hashentry_t2ii entry0_1 = { 0ULL, 0, -1 };
   FX_CALL(_fx_M7HashmapFM9makeindexA1i1i(idxsize_1, &v_2, 0), _fx_cleanup);
   _fx_Rt20Hashmap__hashentry_t2ii* dstptr_1 = 0;
   int_ n_1 = size_1;
   {
      const int_ shape_1[] = { n_1 };
      FX_CALL(fx_make_arr(1, shape_1, sizeof(_fx_Rt20Hashmap__hashentry_t2ii), 0, 0, 0, &v_3), _fx_cleanup);
   }
   dstptr_1 = (_fx_Rt20Hashmap__hashentry_t2ii*)v_3.data;
   for (int_ i_1 = 0; i_1 < n_1; i_1++, dstptr_1++) {
      *dstptr_1 = entry0_1;
   }
   FX_CALL(
      _fx_M8K_mangleFM1tNt10Hashmap__t2ii6Rt20Hashmap__hashentry_t2iiiiiA1iA1Rt20Hashmap__hashentry_t2ii(&entry0_1, 0, 0, 0,
         &v_2, &v_3, &prefix_hash_arg_0), _fx_cleanup);
   FX_CALL(_fx_make_rNt10Hashmap__t2ii(prefix_hash_arg_0, &prefix_hash_ref_0), _fx_cleanup);
   _fx_Nt10Hashmap__t2ii* prefix_hash_0 = &prefix_hash_ref_0->data;
   _fx_M8K_mangleFM7make_fpFPv2N14K_form__kexp_tR22K_form__k_fold_callb_t2rNt10Hashmap__t2iirNt10Hashmap__t2ii(
      global_prefix_hash_ref_0, prefix_hash_ref_0, &mangle_kexp__0);
   _fx_FPv3N14K_form__ktyp_tR10Ast__loc_tR22K_form__k_fold_callb_t mangle_ktyp__fp_0 =
      { _fx_M8K_mangleFM12mangle_ktyp_v3N14K_form__ktyp_tR10Ast__loc_tR22K_form__k_fold_callb_t, 0 };
   FX_COPY_FP(&mangle_ktyp__fp_0, &mangle_ktyp__0);
   FX_CALL(
      _fx_M8K_mangleFM4SomeNt6option1FPv3N14K_form__ktyp_tR10Ast__loc_tR22K_form__k_fold_callb_t1FPv3N14K_form__ktyp_tR10Ast__loc_tR22K_form__k_fold_callb_t(
         &mangle_ktyp__0, &v_4), _fx_cleanup);
   FX_CALL(
      _fx_M8K_mangleFM4SomeNt6option1FPv2N14K_form__kexp_tR22K_form__k_fold_callb_t1FPv2N14K_form__kexp_tR22K_form__k_fold_callb_t(
         &mangle_kexp__0, &v_5), _fx_cleanup);
   _fx_make_R22K_form__k_fold_callb_t(v_4, v_5, _fx_g14K_mangle__None, &mangle_callb_0);
   _fx_LR17K_form__kmodule_t lst_0 = kmods_0;
   for (; lst_0; lst_0 = lst_0->tl) {
      _fx_LN14K_form__kexp_t km_top_0 = 0;
      _fx_R17K_form__kmodule_t* km_0 = &lst_0->hd;
      FX_COPY_PTR(km_0->km_top, &km_top_0);
      _fx_LN14K_form__kexp_t lst_1 = km_top_0;
      for (; lst_1; lst_1 = lst_1->tl) {
         _fx_N14K_form__kexp_t e_0 = lst_1->hd;
         if (FX_REC_VARIANT_TAG(e_0) == 31) {
            _fx_T3R9Ast__id_tN14K_form__kexp_tR10Ast__loc_t* vcase_0 = &e_0->u.KDefVal;
            _fx_R9Ast__id_t* n_2 = &vcase_0->t0;
            if (n_2->m > 0) {
               FX_CALL(
                  _fx_M8K_mangleFM14gen_kval_cnamev4R9Ast__id_tR10Ast__loc_tBrNt10Hashmap__t2ii(n_2, &vcase_0->t2, true,
                     prefix_hash_ref_0, 0), _fx_catch_0);

            _fx_catch_0: ;
               goto _fx_endmatch_0;
            }
         }

      _fx_endmatch_0: ;
         FX_CHECK_EXN(_fx_catch_1);

      _fx_catch_1: ;
         FX_CHECK_EXN(_fx_catch_2);
      }

   _fx_catch_2: ;
      if (km_top_0) {
         _fx_free_LN14K_form__kexp_t(&km_top_0);
      }
      FX_CHECK_EXN(_fx_cleanup);
   }
   _fx_free_Nt10Hashmap__t2ii(global_prefix_hash_0);
   FX_COPY_PTR(*prefix_hash_0, global_prefix_hash_0);
   _fx_LR17K_form__kmodule_t lst_2 = kmods_0;
   for (; lst_2; lst_2 = lst_2->tl) {
      _fx_LN14K_form__kexp_t km_top_1 = 0;
      fx_arr_t v_6 = {0};
      fx_arr_t v_7 = {0};
      fx_arr_t v_8 = {0};
      fx_arr_t v_9 = {0};
      _fx_Nt10Hashmap__t2ii v_10 = 0;
      _fx_R17K_form__kmodule_t* km_1 = &lst_2->hd;
      FX_COPY_PTR(km_1->km_top, &km_top_1);
      _fx_Rt20Hashmap__hashentry_t2ii v_11 = (*global_prefix_hash_0)->u.t.t0;
      fx_copy_arr(&(*global_prefix_hash_0)->u.t.t4, &v_6);
      int_* dstptr_2 = 0;
      int_ ni_0 = FX_ARR_SIZE(v_6, 0);
      int_* ptr_v_0 = FX_PTR_1D(int_, v_6, 0);
      {
         const int_ shape_2[] = { ni_0 };
         FX_CALL(fx_make_arr(1, shape_2, sizeof(int_), 0, 0, 0, &v_7), _fx_catch_4);
      }
      dstptr_2 = (int_*)v_7.data;
      for (int_ i_2 = 0; i_2 < ni_0; i_2++, dstptr_2++) {
         int_ x_0 = ptr_v_0[i_2]; *dstptr_2 = x_0;
      }
      fx_copy_arr(&(*global_prefix_hash_0)->u.t.t5, &v_8);
      _fx_Rt20Hashmap__hashentry_t2ii* dstptr_3 = 0;
      int_ ni_1 = FX_ARR_SIZE(v_8, 0);
      _fx_Rt20Hashmap__hashentry_t2ii* ptr_v_1 = FX_PTR_1D(_fx_Rt20Hashmap__hashentry_t2ii, v_8, 0);
      {
         const int_ shape_3[] = { ni_1 };
         FX_CALL(fx_make_arr(1, shape_3, sizeof(_fx_Rt20Hashmap__hashentry_t2ii), 0, 0, 0, &v_9), _fx_catch_4);
      }
      dstptr_3 = (_fx_Rt20Hashmap__hashentry_t2ii*)v_9.data;
      for (int_ i_3 = 0; i_3 < ni_1; i_3++, dstptr_3++) {
         _fx_Rt20Hashmap__hashentry_t2ii x_1 = ptr_v_1[i_3]; *dstptr_3 = x_1;
      }
      FX_CALL(
         _fx_M8K_mangleFM1tNt10Hashmap__t2ii6Rt20Hashmap__hashentry_t2iiiiiA1iA1Rt20Hashmap__hashentry_t2ii(&v_11,
            (*global_prefix_hash_0)->u.t.t1, (*global_prefix_hash_0)->u.t.t2, (*global_prefix_hash_0)->u.t.t3, &v_7, &v_9,
            &v_10), _fx_catch_4);
      _fx_free_Nt10Hashmap__t2ii(prefix_hash_0);
      FX_COPY_PTR(v_10, prefix_hash_0);
      _fx_LN14K_form__kexp_t lst_3 = km_top_1;
      for (; lst_3; lst_3 = lst_3->tl) {
         _fx_N14K_form__kexp_t e_1 = lst_3->hd;
         FX_CALL(mangle_kexp__0.fp(e_1, &mangle_callb_0, mangle_kexp__0.fcv), _fx_catch_3);

      _fx_catch_3: ;
         FX_CHECK_EXN(_fx_catch_4);
      }

   _fx_catch_4: ;
      if (v_10) {
         _fx_free_Nt10Hashmap__t2ii(&v_10);
      }
      FX_FREE_ARR(&v_9);
      FX_FREE_ARR(&v_8);
      FX_FREE_ARR(&v_7);
      FX_FREE_ARR(&v_6);
      if (km_top_1) {
         _fx_free_LN14K_form__kexp_t(&km_top_1);
      }
      FX_CHECK_EXN(_fx_cleanup);
   }
   FX_COPY_PTR(kmods_0, fx_result);

_fx_cleanup: ;
   FX_FREE_ARR(&v_0);
   FX_FREE_ARR(&v_1);
   if (global_prefix_hash_arg_0) {
      _fx_free_Nt10Hashmap__t2ii(&global_prefix_hash_arg_0);
   }
   if (global_prefix_hash_ref_0) {
      _fx_free_rNt10Hashmap__t2ii(&global_prefix_hash_ref_0);
   }
   FX_FREE_ARR(&v_2);
   FX_FREE_ARR(&v_3);
   if (prefix_hash_arg_0) {
      _fx_free_Nt10Hashmap__t2ii(&prefix_hash_arg_0);
   }
   if (prefix_hash_ref_0) {
      _fx_free_rNt10Hashmap__t2ii(&prefix_hash_ref_0);
   }
   FX_FREE_FP(&mangle_kexp__0);
   FX_FREE_FP(&mangle_ktyp__0);
   if (v_4) {
      _fx_free_Nt6option1FPv3N14K_form__ktyp_tR10Ast__loc_tR22K_form__k_fold_callb_t(&v_4);
   }
   if (v_5) {
      _fx_free_Nt6option1FPv2N14K_form__kexp_tR22K_form__k_fold_callb_t(&v_5);
   }
   _fx_free_R22K_form__k_fold_callb_t(&mangle_callb_0);
   return fx_status;
}

static int _fx_M8K_mangleFM14gen_kval_cnamev4R9Ast__id_tR10Ast__loc_tBrNt10Hashmap__t2ii(
   struct _fx_R9Ast__id_t* n_0,
   struct _fx_R10Ast__loc_t* loc_0,
   bool global_0,
   struct _fx_rNt10Hashmap__t2ii_data_t* prefix_hash_ref_0,
   void* fx_fv)
{
   _fx_R17K_form__kdefval_t kv_0 = {0};
   fx_str_t kv_cname_0 = {0};
   fx_str_t v_0 = {0};
   fx_str_t v_1 = {0};
   fx_str_t v_2 = {0};
   fx_str_t v_3 = {0};
   fx_str_t new_cname_0 = {0};
   _fx_R17K_form__kdefval_t v_4 = {0};
   _fx_N15K_form__kinfo_t v_5 = {0};
   int fx_status = 0;
   _fx_Nt10Hashmap__t2ii* prefix_hash_0 = &prefix_hash_ref_0->data;
   if (n_0->m > 0) {
      FX_CALL(_fx_M6K_formFM8get_kvalRM9kdefval_t2R9Ast__id_tR10Ast__loc_t(n_0, loc_0, &kv_0, 0), _fx_cleanup);
      fx_copy_str(&kv_0.kv_cname, &kv_cname_0);
      if (FX_STR_LENGTH(kv_cname_0) == 0) {
         int_ prefix_0;
         if (global_0) {
            int_ v_6 = n_0->i;
            FX_CHKIDX(FX_CHKIDX1(_fx_g14Ast__all_names->u.t.t1, 0, v_6), _fx_cleanup);
            fx_copy_str(FX_PTR_1D(fx_str_t, _fx_g14Ast__all_names->u.t.t1, v_6), &v_0);
            fx_str_t slit_0 = FX_MAKE_STR("g_");
            {
               const fx_str_t strs_0[] = { slit_0, v_0 };
               FX_CALL(fx_strjoin(0, 0, 0, strs_0, 2, &v_1), _fx_cleanup);
            }
            _fx_R9Ast__id_t v_7;
            FX_CALL(_fx_M3AstFM6get_idRM4id_t1S(&v_1, &v_7, 0), _fx_cleanup);
            prefix_0 = v_7.i;
         }
         else {
            prefix_0 = n_0->i;
         }
         int_ idx_0;
         FX_CALL(_fx_M8K_mangleFM18find_idx_or_inserti2Nt10Hashmap__t2iii(*prefix_hash_0, prefix_0, &idx_0, 0), _fx_cleanup);
         FX_CHKIDX(FX_CHKIDX1((*prefix_hash_0)->u.t.t5, 0, idx_0), _fx_cleanup);
         int_ j1_0 = FX_PTR_1D(_fx_Rt20Hashmap__hashentry_t2ii, (*prefix_hash_0)->u.t.t5, idx_0)->data + 1;
         FX_CHKIDX(FX_CHKIDX1((*prefix_hash_0)->u.t.t5, 0, idx_0), _fx_cleanup);
         FX_PTR_1D(_fx_Rt20Hashmap__hashentry_t2ii, (*prefix_hash_0)->u.t.t5, idx_0)->data = j1_0;
         FX_CHKIDX(FX_CHKIDX1(_fx_g14Ast__all_names->u.t.t1, 0, prefix_0), _fx_cleanup);
         fx_copy_str(FX_PTR_1D(fx_str_t, _fx_g14Ast__all_names->u.t.t1, prefix_0), &v_2);
         FX_CALL(_fx_F6stringS1i(j1_0, &v_3, 0), _fx_cleanup);
         fx_str_t slit_1 = FX_MAKE_STR("_");
         {
            const fx_str_t strs_1[] = { v_2, slit_1, v_3 };
            FX_CALL(fx_strjoin(0, 0, 0, strs_1, 3, &new_cname_0), _fx_cleanup);
         }
         _fx_make_R17K_form__kdefval_t(&kv_0.kv_name, &new_cname_0, kv_0.kv_typ, &kv_0.kv_flags, &kv_0.kv_loc, &v_4);
         _fx_M6K_formFM4KValN15K_form__kinfo_t1RM9kdefval_t(&v_4, &v_5);
         FX_CALL(_fx_M6K_formFM13set_idk_entryv2R9Ast__id_tN15K_form__kinfo_t(n_0, &v_5, 0), _fx_cleanup);
      }
   }

_fx_cleanup: ;
   _fx_free_R17K_form__kdefval_t(&kv_0);
   FX_FREE_STR(&kv_cname_0);
   FX_FREE_STR(&v_0);
   FX_FREE_STR(&v_1);
   FX_FREE_STR(&v_2);
   FX_FREE_STR(&v_3);
   FX_FREE_STR(&new_cname_0);
   _fx_free_R17K_form__kdefval_t(&v_4);
   _fx_free_N15K_form__kinfo_t(&v_5);
   return fx_status;
}

static int _fx_M8K_mangleFM12mangle_kexp_v2N14K_form__kexp_tR22K_form__k_fold_callb_t(
   struct _fx_N14K_form__kexp_t_data_t* e_0,
   struct _fx_R22K_form__k_fold_callb_t* callb_0,
   void* fx_fv)
{
   int fx_status = 0;
   FX_CALL(fx_check_stack(), _fx_cleanup);
   _fx_M8K_mangleFM12mangle_kexp_v2N14K_form__kexp_tR22K_form__k_fold_callb_t_cldata_t* cv_0 =
      (_fx_M8K_mangleFM12mangle_kexp_v2N14K_form__kexp_tR22K_form__k_fold_callb_t_cldata_t*)fx_fv;
   _fx_rNt10Hashmap__t2ii prefix_hash_ref_0 = cv_0->t1;
   _fx_Nt10Hashmap__t2ii* global_prefix_hash_0 = &cv_0->t0->data;
   _fx_Nt10Hashmap__t2ii* prefix_hash_0 = &prefix_hash_ref_0->data;
   int tag_0 = FX_REC_VARIANT_TAG(e_0);
   if (tag_0 == 31) {
      _fx_T3R9Ast__id_tN14K_form__kexp_tR10Ast__loc_t* vcase_0 = &e_0->u.KDefVal;
      FX_CALL(_fx_M8K_mangleFM12mangle_kexp_v2N14K_form__kexp_tR22K_form__k_fold_callb_t(vcase_0->t1, callb_0, fx_fv),
         _fx_catch_0);
      FX_CALL(
         _fx_M8K_mangleFM14gen_kval_cnamev4R9Ast__id_tR10Ast__loc_tBrNt10Hashmap__t2ii(&vcase_0->t0, &vcase_0->t2, false,
            prefix_hash_ref_0, 0), _fx_catch_0);

   _fx_catch_0: ;
   }
   else if (tag_0 == 32) {
      _fx_N14K_form__kexp_t kf_body_0 = 0;
      _fx_LR9Ast__id_t kf_params_0 = 0;
      _fx_Nt10Hashmap__t2ii saved_hash_0 = 0;
      fx_arr_t v_0 = {0};
      fx_arr_t v_1 = {0};
      fx_arr_t v_2 = {0};
      fx_arr_t v_3 = {0};
      _fx_Nt10Hashmap__t2ii v_4 = 0;
      _fx_R17K_form__kdeffun_t* v_5 = &e_0->u.KDefFun->data;
      _fx_R10Ast__loc_t kf_loc_0 = v_5->kf_loc;
      FX_COPY_PTR(v_5->kf_body, &kf_body_0);
      FX_COPY_PTR(v_5->kf_params, &kf_params_0);
      FX_COPY_PTR(*prefix_hash_0, &saved_hash_0);
      _fx_Rt20Hashmap__hashentry_t2ii v_6 = (*global_prefix_hash_0)->u.t.t0;
      fx_copy_arr(&(*global_prefix_hash_0)->u.t.t4, &v_0);
      int_* dstptr_0 = 0;
      int_ ni_0 = FX_ARR_SIZE(v_0, 0);
      int_* ptr_v_0 = FX_PTR_1D(int_, v_0, 0);
      {
         const int_ shape_0[] = { ni_0 };
         FX_CALL(fx_make_arr(1, shape_0, sizeof(int_), 0, 0, 0, &v_1), _fx_catch_2);
      }
      dstptr_0 = (int_*)v_1.data;
      for (int_ i_0 = 0; i_0 < ni_0; i_0++, dstptr_0++) {
         int_ x_0 = ptr_v_0[i_0]; *dstptr_0 = x_0;
      }
      fx_copy_arr(&(*global_prefix_hash_0)->u.t.t5, &v_2);
      _fx_Rt20Hashmap__hashentry_t2ii* dstptr_1 = 0;
      int_ ni_1 = FX_ARR_SIZE(v_2, 0);
      _fx_Rt20Hashmap__hashentry_t2ii* ptr_v_1 = FX_PTR_1D(_fx_Rt20Hashmap__hashentry_t2ii, v_2, 0);
      {
         const int_ shape_1[] = { ni_1 };
         FX_CALL(fx_make_arr(1, shape_1, sizeof(_fx_Rt20Hashmap__hashentry_t2ii), 0, 0, 0, &v_3), _fx_catch_2);
      }
      dstptr_1 = (_fx_Rt20Hashmap__hashentry_t2ii*)v_3.data;
      for (int_ i_1 = 0; i_1 < ni_1; i_1++, dstptr_1++) {
         _fx_Rt20Hashmap__hashentry_t2ii x_1 = ptr_v_1[i_1]; *dstptr_1 = x_1;
      }
      FX_CALL(
         _fx_M8K_mangleFM1tNt10Hashmap__t2ii6Rt20Hashmap__hashentry_t2iiiiiA1iA1Rt20Hashmap__hashentry_t2ii(&v_6,
            (*global_prefix_hash_0)->u.t.t1, (*global_prefix_hash_0)->u.t.t2, (*global_prefix_hash_0)->u.t.t3, &v_1, &v_3,
            &v_4), _fx_catch_2);
      _fx_free_Nt10Hashmap__t2ii(prefix_hash_0);
      FX_COPY_PTR(v_4, prefix_hash_0);
      _fx_LR9Ast__id_t lst_0 = kf_params_0;
      for (; lst_0; lst_0 = lst_0->tl) {
         _fx_R9Ast__id_t* x_2 = &lst_0->hd;
         FX_CALL(
            _fx_M8K_mangleFM14gen_kval_cnamev4R9Ast__id_tR10Ast__loc_tBrNt10Hashmap__t2ii(x_2, &kf_loc_0, false,
               prefix_hash_ref_0, 0), _fx_catch_1);

      _fx_catch_1: ;
         FX_CHECK_EXN(_fx_catch_2);
      }
      FX_CALL(_fx_M8K_mangleFM12mangle_kexp_v2N14K_form__kexp_tR22K_form__k_fold_callb_t(kf_body_0, callb_0, fx_fv),
         _fx_catch_2);
      _fx_free_Nt10Hashmap__t2ii(prefix_hash_0);
      FX_COPY_PTR(saved_hash_0, prefix_hash_0);

   _fx_catch_2: ;
      if (v_4) {
         _fx_free_Nt10Hashmap__t2ii(&v_4);
      }
      FX_FREE_ARR(&v_3);
      FX_FREE_ARR(&v_2);
      FX_FREE_ARR(&v_1);
      FX_FREE_ARR(&v_0);
      if (saved_hash_0) {
         _fx_free_Nt10Hashmap__t2ii(&saved_hash_0);
      }
      FX_FREE_LIST_SIMPLE(&kf_params_0);
      if (kf_body_0) {
         _fx_free_N14K_form__kexp_t(&kf_body_0);
      }
   }
   else if (tag_0 == 26) {
      _fx_LT3N14K_form__kexp_tLT2R9Ast__id_tN13K_form__dom_tLR9Ast__id_t clauses_0 = 0;
      _fx_T4LT3N14K_form__kexp_tLT2R9Ast__id_tN13K_form__dom_tLR9Ast__id_tN14K_form__kexp_tR16Ast__for_flags_tT2N14K_form__ktyp_tR10Ast__loc_t*
         vcase_1 = &e_0->u.KExpMap;
      _fx_R10Ast__loc_t* loc_0 = &vcase_1->t3.t1;
      FX_CALL(_fx_M6K_formFM9fold_kexpv2N14K_form__kexp_tRM14k_fold_callb_t(e_0, callb_0, 0), _fx_catch_6);
      FX_COPY_PTR(vcase_1->t0, &clauses_0);
      _fx_LT3N14K_form__kexp_tLT2R9Ast__id_tN13K_form__dom_tLR9Ast__id_t lst_1 = clauses_0;
      for (; lst_1; lst_1 = lst_1->tl) {
         _fx_LT2R9Ast__id_tN13K_form__dom_t id_l_0 = 0;
         _fx_LR9Ast__id_t at_ids_0 = 0;
         _fx_T3N14K_form__kexp_tLT2R9Ast__id_tN13K_form__dom_tLR9Ast__id_t* __pat___0 = &lst_1->hd;
         FX_COPY_PTR(__pat___0->t1, &id_l_0);
         FX_COPY_PTR(__pat___0->t2, &at_ids_0);
         _fx_LR9Ast__id_t lst_2 = at_ids_0;
         for (; lst_2; lst_2 = lst_2->tl) {
            _fx_R9Ast__id_t* i_2 = &lst_2->hd;
            FX_CALL(
               _fx_M8K_mangleFM14gen_kval_cnamev4R9Ast__id_tR10Ast__loc_tBrNt10Hashmap__t2ii(i_2, loc_0, false,
                  prefix_hash_ref_0, 0), _fx_catch_3);

         _fx_catch_3: ;
            FX_CHECK_EXN(_fx_catch_5);
         }
         _fx_LT2R9Ast__id_tN13K_form__dom_t lst_3 = id_l_0;
         for (; lst_3; lst_3 = lst_3->tl) {
            _fx_T2R9Ast__id_tN13K_form__dom_t* __pat___1 = &lst_3->hd;
            _fx_R9Ast__id_t i_3 = __pat___1->t0;
            FX_CALL(
               _fx_M8K_mangleFM14gen_kval_cnamev4R9Ast__id_tR10Ast__loc_tBrNt10Hashmap__t2ii(&i_3, loc_0, false,
                  prefix_hash_ref_0, 0), _fx_catch_4);

         _fx_catch_4: ;
            FX_CHECK_EXN(_fx_catch_5);
         }

      _fx_catch_5: ;
         FX_FREE_LIST_SIMPLE(&at_ids_0);
         if (id_l_0) {
            _fx_free_LT2R9Ast__id_tN13K_form__dom_t(&id_l_0);
         }
         FX_CHECK_EXN(_fx_catch_6);
      }

   _fx_catch_6: ;
      if (clauses_0) {
         _fx_free_LT3N14K_form__kexp_tLT2R9Ast__id_tN13K_form__dom_tLR9Ast__id_t(&clauses_0);
      }
   }
   else if (tag_0 == 27) {
      _fx_LR9Ast__id_t at_ids_1 = 0;
      _fx_LT2R9Ast__id_tN13K_form__dom_t id_l_1 = 0;
      _fx_T5LT2R9Ast__id_tN13K_form__dom_tLR9Ast__id_tN14K_form__kexp_tR16Ast__for_flags_tR10Ast__loc_t* vcase_2 =
         &e_0->u.KExpFor;
      _fx_R10Ast__loc_t* loc_1 = &vcase_2->t4;
      FX_CALL(_fx_M6K_formFM9fold_kexpv2N14K_form__kexp_tRM14k_fold_callb_t(e_0, callb_0, 0), _fx_catch_9);
      FX_COPY_PTR(vcase_2->t1, &at_ids_1);
      _fx_LR9Ast__id_t lst_4 = at_ids_1;
      for (; lst_4; lst_4 = lst_4->tl) {
         _fx_R9Ast__id_t* i_4 = &lst_4->hd;
         FX_CALL(
            _fx_M8K_mangleFM14gen_kval_cnamev4R9Ast__id_tR10Ast__loc_tBrNt10Hashmap__t2ii(i_4, loc_1, false, prefix_hash_ref_0,
               0), _fx_catch_7);

      _fx_catch_7: ;
         FX_CHECK_EXN(_fx_catch_9);
      }
      FX_COPY_PTR(vcase_2->t0, &id_l_1);
      _fx_LT2R9Ast__id_tN13K_form__dom_t lst_5 = id_l_1;
      for (; lst_5; lst_5 = lst_5->tl) {
         _fx_T2R9Ast__id_tN13K_form__dom_t* __pat___2 = &lst_5->hd;
         _fx_R9Ast__id_t i_5 = __pat___2->t0;
         FX_CALL(
            _fx_M8K_mangleFM14gen_kval_cnamev4R9Ast__id_tR10Ast__loc_tBrNt10Hashmap__t2ii(&i_5, loc_1, false, prefix_hash_ref_0,
               0), _fx_catch_8);

      _fx_catch_8: ;
         FX_CHECK_EXN(_fx_catch_9);
      }

   _fx_catch_9: ;
      if (id_l_1) {
         _fx_free_LT2R9Ast__id_tN13K_form__dom_t(&id_l_1);
      }
      FX_FREE_LIST_SIMPLE(&at_ids_1);
   }
   else {
      FX_CALL(_fx_M6K_formFM9fold_kexpv2N14K_form__kexp_tRM14k_fold_callb_t(e_0, callb_0, 0), _fx_catch_10);  _fx_catch_10: ;
   }

_fx_cleanup: ;
   return fx_status;
}

FX_EXTERN_C int _fx_M8K_mangleFM7make_fpFPv2N14K_form__kexp_tR22K_form__k_fold_callb_t2rNt10Hashmap__t2iirNt10Hashmap__t2ii(
   struct _fx_rNt10Hashmap__t2ii_data_t* arg0,
   struct _fx_rNt10Hashmap__t2ii_data_t* arg1,
   struct _fx_FPv2N14K_form__kexp_tR22K_form__k_fold_callb_t* fx_result)
{
   FX_MAKE_FP_IMPL_START(_fx_M8K_mangleFM12mangle_kexp_v2N14K_form__kexp_tR22K_form__k_fold_callb_t_cldata_t,
      _fx_free_M8K_mangleFM12mangle_kexp_v2N14K_form__kexp_tR22K_form__k_fold_callb_t,
      _fx_M8K_mangleFM12mangle_kexp_v2N14K_form__kexp_tR22K_form__k_fold_callb_t);
   FX_COPY_PTR(arg0, &fcv->t0);
   FX_COPY_PTR(arg1, &fcv->t1);
   return 0;
}

FX_EXTERN_C int fx_init_K_mangle(void)
{
   int fx_status = 0;
   return fx_status;
}

FX_EXTERN_C void fx_deinit_K_mangle(void)
{

}

